Bug 1498434 - add new telemetry probe to know the delay caused by e10s back pressure r=valentin
authorJunior Hsu <juhsu@mozilla.com>
Tue, 23 Oct 2018 22:17:22 +0000
changeset 491220 f2ce0b583163feb057514003da2d60cc2fee8e28
parent 491219 f7fe04d00e18682a760b3fcb458c2be801e59184
child 491221 79b5f27ba745e51feaeeb4c8cee773620f3e4387
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersvalentin
bugs1498434
milestone65.0a1
Bug 1498434 - add new telemetry probe to know the delay caused by e10s back pressure r=valentin a straight forward implementation Differential Revision: https://phabricator.services.mozilla.com/D9038
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/HttpChannelParent.h
toolkit/components/telemetry/Histograms.json
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -1723,16 +1723,21 @@ HttpChannelParent::OnDataAvailable(nsIRe
 
   if (NeedFlowControl()) {
     // We're going to run out of sending window size
     if (mSendWindowSize > 0 && mSendWindowSize <= count) {
       MOZ_ASSERT(!mSuspendedForFlowControl);
       Unused << mChannel->Suspend();
       mSuspendedForFlowControl = true;
       mHasSuspendedByBackPressure = true;
+    } else if (!mResumedTimestamp.IsNull()) {
+      // Calculate the delay when the first packet arrived after resume
+      Telemetry::AccumulateTimeDelta(Telemetry::NETWORK_BACK_PRESSURE_SUSPENSION_DELAY_TIME_MS,
+                                     mResumedTimestamp);
+      mResumedTimestamp = TimeStamp();
     }
     mSendWindowSize -= count;
   }
 
   return NS_OK;
 }
 
 bool
@@ -1771,16 +1776,18 @@ HttpChannelParent::RecvBytesRead(const i
   }
 
   LOG(("HttpChannelParent::RecvBytesRead [this=%p count=%" PRId32 "]\n", this, aCount));
 
   if (mSendWindowSize <= 0 && mSendWindowSize + aCount > 0) {
     MOZ_ASSERT(mSuspendedForFlowControl);
     Unused << mChannel->Resume();
     mSuspendedForFlowControl = false;
+
+    mResumedTimestamp = TimeStamp::Now();
   }
   mSendWindowSize += aCount;
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 HttpChannelParent::RecvOpenOriginalCacheInputStream()
 {
--- a/netwerk/protocol/http/HttpChannelParent.h
+++ b/netwerk/protocol/http/HttpChannelParent.h
@@ -294,16 +294,19 @@ private:
 
   RefPtr<HttpBackgroundChannelParent> mBgParent;
 
   MozPromiseHolder<GenericPromise> mPromise;
   MozPromiseRequestHolder<GenericPromise> mRequest;
 
   dom::TabId mNestedFrameId;
 
+  // To calculate the delay caused by the e10s back-pressure suspension
+  TimeStamp mResumedTimestamp;
+
   Atomic<bool> mIPCClosed; // PHttpChannel actor has been Closed()
 
   // Corresponding redirect channel registrar Id. 0 means redirection is not started.
   uint32_t mRedirectRegistrarId = 0;
 
   PBOverrideStatus mPBOverride;
 
   // Set to the canceled status value if the main channel was canceled.
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -2011,16 +2011,26 @@
     "record_in_processes": ["main"],
     "expires_in_version": "68",
     "alert_emails": ["necko@mozilla.com", "junior@mozilla.com"],
     "bug_numbers": [1487559],
     "kind": "enumerated",
     "n_values": 64,
     "description": "Collect the content policy when the resource is non-local and suspended by back pressure (0-44 from nsContentPolicyType in nsIContentPolicy.idl)."
   },
+  "NETWORK_BACK_PRESSURE_SUSPENSION_DELAY_TIME_MS": {
+    "record_in_processes": ["main"],
+    "expires_in_version": "68",
+    "alert_emails": ["necko@mozilla.com", "junior@mozilla.com"],
+    "bug_numbers": [1498434],
+    "kind": "exponential",
+    "high": 60000,
+    "n_buckets": 100,
+    "description": "The delay caused by the e10s back pressure suspension(ms)"
+  },
   "NETWORK_HTTP_REDIRECT_TO_SCHEME" :{
     "record_in_processes": ["main"],
     "alert_emails": ["necko@mozilla.com", "seceng-telemetry@mozilla.com", "jkt@mozilla.com"],
     "bug_numbers": [1413512],
     "expires_in_version": "64",
     "kind": "categorical",
     "keyed": true,
     "description": "Count of the HTTP redirection that triggered by top-level document or by subresource, keyed by the URL scheme redirected to.",