Bug 1369538 - Telemetry MEDIACACHESTREAM_LENGTH_KB - r=cpearce,francois
authorGerald Squelart <gsquelart@mozilla.com>
Fri, 02 Jun 2017 10:43:45 +1200
changeset 410539 a7e36fe5ac723903f95532b93a1af63c4a1efc3b
parent 410538 0cf5121dfb27b707912e80851c93091dd00418ac
child 410540 56b99cb0d9c7f9c0b9a082475fd7d497964aee59
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, francois
bugs1369538
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1369538 - Telemetry MEDIACACHESTREAM_LENGTH_KB - r=cpearce,francois Capture each media stream's length (as provided, otherwise as actually downloaded), to gauge whether keeping media in memory would have a significant impact. MozReview-Commit-ID: 4yUQrbgLcGG
dom/media/MediaCache.cpp
toolkit/components/telemetry/Histograms.json
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -1961,16 +1961,25 @@ MediaCacheStream::~MediaCacheStream()
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
   NS_ASSERTION(!mPinCount, "Unbalanced Pin");
 
   if (gMediaCache) {
     NS_ASSERTION(mClosed, "Stream was not closed");
     gMediaCache->ReleaseStream(this);
     MediaCache::MaybeShutdown();
   }
+
+  uint32_t lengthKb = uint32_t(
+    std::min(std::max(mStreamLength, int64_t(0)) / 1024, int64_t(UINT32_MAX)));
+  LOG("MediaCacheStream::~MediaCacheStream(this=%p) "
+      "MEDIACACHESTREAM_LENGTH_KB=%" PRIu32,
+      this,
+      lengthKb);
+  Telemetry::Accumulate(Telemetry::HistogramID::MEDIACACHESTREAM_LENGTH_KB,
+                        lengthKb);
 }
 
 void
 MediaCacheStream::SetTransportSeekable(bool aIsTransportSeekable)
 {
   ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
   NS_ASSERTION(mIsTransportSeekable || aIsTransportSeekable ||
                mChannelOffset == 0, "channel offset must be zero when we become non-seekable");
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8393,16 +8393,26 @@
     "record_in_processes": ["main", "content"],
     "alert_emails": ["gsquelart@mozilla.com"],
     "bug_numbers": [1366936],
     "expires_in_version": "60",
     "kind": "enumerated",
     "n_values": 32,
     "description": "Maximum number of owners for each MediaCache block. Recorded at every MediaCache destruction, i.e., whenever there is no more media data to be downloaded or kept for playback."
   },
+  "MEDIACACHESTREAM_LENGTH_KB": {
+    "record_in_processes": ["main", "content"],
+    "alert_emails": ["gsquelart@mozilla.com"],
+    "bug_numbers": [1369538],
+    "expires_in_version": "60",
+    "kind": "linear",
+    "high": 520000,
+    "n_buckets": 66,
+    "description": "MediaCacheStream stream length size in KB; Either known size from the HTTP header if available, or otherwise the size actually downloaded. Recorded at every MediaCacheStream destruction."
+  },
   "VIDEO_MFT_OUTPUT_NULL_SAMPLES": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["cpearce@mozilla.com"],
     "expires_in_version": "53",
     "kind": "enumerated",
     "n_values": 10,
     "description": "Does the WMF video decoder return success but null output? 0 = playback successful, 1 = excessive null output but able to decode some frames, 2 = excessive null output and gave up, 3 = null output but recovered, 4 = non-excessive null output without being able to decode frames.",
     "bug_numbers": [1176071]