Bug 1404535: Add telemetry that times nr_ice_gather. r+drno r=chutten,drno,liuche
authorByron Campen [:bwc] <docfaraday@gmail.com>
Fri, 29 Sep 2017 17:49:32 -0500
changeset 385954 5ede138b6e27cfd84d87e65e039623a5dc683121
parent 385953 4730ce3175f8ce3f10c40af5e21c6831668187a8
child 385955 66b011b6b2af7b3bbefddc870352df92bf88cf38
push id32672
push userarchaeopteryx@coole-files.de
push dateFri, 13 Oct 2017 09:00:05 +0000
treeherdermozilla-central@3efcb26e5f37 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten, drno, liuche
bugs1404535
milestone58.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 1404535: Add telemetry that times nr_ice_gather. r+drno r=chutten,drno,liuche MozReview-Commit-ID: I4nH8sZNX5g
media/mtransport/nricectx.cpp
toolkit/components/telemetry/Histograms.json
--- a/media/mtransport/nricectx.cpp
+++ b/media/mtransport/nricectx.cpp
@@ -959,28 +959,37 @@ void NrIceCtx::SetCtxFlags(bool default_
 }
 
 nsresult NrIceCtx::StartGathering(bool default_route_only, bool proxy_only) {
   ASSERT_ON_THREAD(sts_target_);
   SetGatheringState(ICE_CTX_GATHER_STARTED);
 
   SetCtxFlags(default_route_only, proxy_only);
 
+  TimeStamp start = TimeStamp::Now();
   // This might start gathering for the first time, or again after
   // renegotiation, or might do nothing at all if gathering has already
   // finished.
   int r = nr_ice_gather(ctx_, &NrIceCtx::gather_cb, this);
 
+
   if (!r) {
     SetGatheringState(ICE_CTX_GATHER_COMPLETE);
+    Telemetry::AccumulateTimeDelta(
+        Telemetry::WEBRTC_ICE_NR_ICE_GATHER_TIME_IMMEDIATE_SUCCESS, start);
   } else if (r != R_WOULDBLOCK) {
     MOZ_MTLOG(ML_ERROR, "Couldn't gather ICE candidates for '"
                         << name_ << "', error=" << r);
     SetConnectionState(ICE_CTX_FAILED);
+    Telemetry::AccumulateTimeDelta(
+        Telemetry::WEBRTC_ICE_NR_ICE_GATHER_TIME_IMMEDIATE_FAILURE, start);
     return NS_ERROR_FAILURE;
+  } else {
+    Telemetry::AccumulateTimeDelta(
+        Telemetry::WEBRTC_ICE_NR_ICE_GATHER_TIME, start);
   }
 
   return NS_OK;
 }
 
 RefPtr<NrIceMediaStream> NrIceCtx::FindStream(
     nr_ice_media_stream *stream) {
   for (auto& stream_ : streams_) {
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8819,16 +8819,46 @@
     "alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com"],
     "bug_numbers": [1342523],
     "expires_in_version": "60",
     "kind": "exponential",
     "high": 10000,
     "n_buckets": 20,
     "description": "The length of time (in milliseconds) it took for the answerer to complete ICE, given that it failed. Does not count cases where StartChecks() was never called."
   },
+  "WEBRTC_ICE_NR_ICE_GATHER_TIME": {
+    "record_in_processes": ["content"],
+    "alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com", "bcampen@mozilla.com"],
+    "bug_numbers": [1319268],
+    "expires_in_version": "60",
+    "kind": "exponential",
+    "high": 10000,
+    "n_buckets": 20,
+    "description": "The length of time (in milliseconds) it took to call nr_ice_gather, given that gathering did not succeed/fail immediately during the call."
+  },
+  "WEBRTC_ICE_NR_ICE_GATHER_TIME_IMMEDIATE_FAILURE": {
+    "record_in_processes": ["content"],
+    "alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com", "bcampen@mozilla.com"],
+    "bug_numbers": [1319268],
+    "expires_in_version": "60",
+    "kind": "exponential",
+    "high": 10000,
+    "n_buckets": 20,
+    "description": "The length of time (in milliseconds) it took to call nr_ice_gather, given that gathering failed immediately during the call."
+  },
+  "WEBRTC_ICE_NR_ICE_GATHER_TIME_IMMEDIATE_SUCCESS": {
+    "record_in_processes": ["content"],
+    "alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com", "bcampen@mozilla.com"],
+    "bug_numbers": [1319268],
+    "expires_in_version": "60",
+    "kind": "exponential",
+    "high": 10000,
+    "n_buckets": 20,
+    "description": "The length of time (in milliseconds) it took to call nr_ice_gather, given that gathering succeeded immediately during the call."
+  },
   "WEBRTC_ICE_SUCCESS_TIME": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com"],
     "bug_numbers": [1319268],
     "expires_in_version": "58",
     "kind": "exponential",
     "high": 10000,
     "n_buckets": 20,