Bug 1458337 - eliminate unneeded runnable histograms; r=farre
authorNathan Froyd <froydnj@mozilla.com>
Wed, 13 Jun 2018 18:12:11 -0400
changeset 422549 25ff84f2bac3
parent 422548 cf89498e0dec
child 422550 cb09f382ff47
push id34138
push userdluca@mozilla.com
push dateFri, 15 Jun 2018 02:39:59 +0000
treeherdermozilla-central@e51f8dbf0397 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfarre
bugs1458337
milestone62.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 1458337 - eliminate unneeded runnable histograms; r=farre We no longer care about these histograms, and the measurements that they take can be noticed in profiles.
toolkit/components/telemetry/Histograms.json
xpcom/threads/nsThread.cpp
xpcom/threads/nsThread.h
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -12909,27 +12909,16 @@
     "kind": "linear",
     "low": 1000,
     "high": 90000,
     "n_buckets": 91,
     "bug_numbers": [1314220],
     "description": "The time duration from tab's media was blocked to unblocked. Now we record from 1 to 90 seconds, but the record by milliseconds, so the bucket is like [1000ms, 2000ms], [2000ms, 3000ms], e.t.c.",
     "releaseChannelCollection": "opt-out"
   },
-  "MAIN_THREAD_RUNNABLE_MS": {
-    "record_in_processes": ["main", "content", "gpu"],
-    "alert_emails": ["wmccloskey@mozilla.com", "farre@mozilla.com"],
-    "expires_in_version": "70",
-    "kind": "exponential",
-    "keyed": true,
-    "high": 10000,
-    "n_buckets": 10,
-    "bug_numbers": [1331804],
-    "description": "The time a given main thread runnable took to run (in milliseconds). The key comes from the runnables nsINamed::name value."
-  },
   "MOZ_CHUNKED_ARRAYBUFFER_IN_XHR": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["amarchesini@mozilla.com"],
     "expires_in_version": "58",
     "kind": "boolean",
     "bug_numbers": [1335365],
     "releaseChannelCollection": "opt-out",
     "description": "XMLHttpRequest.responseType set to moz-chunked-arraybuffer"
@@ -13257,26 +13246,16 @@
     "alert_emails": ["wpan@mozilla.com"],
     "expires_in_version": "60",
     "kind": "exponential",
     "high": 5000,
     "n_buckets": 100,
     "bug_numbers": [1345540],
     "description": "Time (ms) for the APZ handled wheel event spent in handlers."
   },
-  "TIME_BETWEEN_UNLABELED_RUNNABLES_MS": {
-    "record_in_processes": ["content"],
-    "alert_emails": ["wmccloskey@mozilla.com", "farre@mozilla.com"],
-    "expires_in_version": "70",
-    "kind": "exponential",
-    "high": 30000,
-    "n_buckets": 30,
-    "bug_numbers": [1351021],
-    "description": "Every time we run an unlabeled runnable, this histogram records the time (in ms) since the last unlabeled runnable ran."
-  },
   "VFC_INVALIDATE_LOCK_WAIT_MS": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["jwwang@mozilla.com"],
     "expires_in_version": "57",
     "kind": "exponential",
     "low": 1000,
     "high": 100000,
     "n_buckets": 100,
@@ -13356,27 +13335,16 @@
     "expires_in_version": "70",
     "kind": "exponential",
     "low": 32,
     "high": 750,
     "n_buckets": 40,
     "keyed": true,
     "description": "Measures the number of milliseconds we spend processing sync IPC messages in the receiving process, keyed by message name. Note: only messages that take over 500 microseconds are included in this probe."
   },
-  "IDLE_RUNNABLE_BUDGET_OVERUSE_MS": {
-    "record_in_processes": ["main", "content", "gpu"],
-    "alert_emails": ["farre@mozilla.com"],
-    "expires_in_version": "70",
-    "kind": "exponential",
-    "keyed": true,
-    "high": 10000,
-    "n_buckets": 10,
-    "bug_numbers": [1292600],
-    "description": "The time a given runnable exceeds its budget as set in nsIRunnable::SetDeadline (in milliseconds). The key comes from the runnables nsINamed::name value."
-  },
   "WEBEXT_BACKGROUND_PAGE_LOAD_MS": {
     "record_in_processes": ["main"],
     "alert_emails": ["addons-dev-internal@mozilla.com"],
     "bug_numbers": [1353172],
     "expires_in_version": "67",
     "kind": "exponential",
     "releaseChannelCollection": "opt-out",
     "high": 60000,
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -551,17 +551,16 @@ nsThread::nsThread(NotNull<SynchronizedE
   , mScriptObserver(nullptr)
   , mPriority(PRIORITY_NORMAL)
   , mThread(nullptr)
   , mNestedEventLoopDepth(0)
   , mStackSize(aStackSize)
   , mShutdownContext(nullptr)
   , mShutdownRequired(false)
   , mIsMainThread(aMainThread)
-  , mLastUnlabeledRunnable(TimeStamp::Now())
   , mCanInvokeJS(false)
   , mCurrentEvent(nullptr)
   , mCurrentEventStart(TimeStamp::Now())
   , mCurrentEventLoopDepth(-1)
   , mCurrentPerformanceCounter(nullptr)
 {
 }
 
@@ -1010,58 +1009,30 @@ nsThread::ProcessNextEvent(bool aMayWait
           && mCurrentPerformanceCounter) {
           // This is a recursive call, we're saving the time
           // spent in the parent event if the runnable is linked to a DocGroup.
           mozilla::TimeDuration duration = TimeStamp::Now() - mCurrentEventStart;
           mCurrentPerformanceCounter->IncrementExecutionDuration(duration.ToMicroseconds());
       }
 
 #ifdef MOZ_COLLECTING_RUNNABLE_TELEMETRY
-      Maybe<Telemetry::AutoTimer<Telemetry::MAIN_THREAD_RUNNABLE_MS>> timer;
-      Maybe<Telemetry::AutoTimer<Telemetry::IDLE_RUNNABLE_BUDGET_OVERUSE_MS>> idleTimer;
-
-      nsAutoCString name;
-      if ((MAIN_THREAD == mIsMainThread) || mNextIdleDeadline) {
-        bool labeled = GetLabeledRunnableName(event, name, priority);
-
-        if (MAIN_THREAD == mIsMainThread) {
-          timer.emplace(name);
-
-          // High-priority runnables are ignored here since they'll run right away
-          // even with the cooperative scheduler.
-          if (!labeled && (priority == EventPriority::Normal ||
-                           priority == EventPriority::Idle)) {
-            TimeStamp now = TimeStamp::Now();
-            double diff = (now - mLastUnlabeledRunnable).ToMilliseconds();
-            Telemetry::Accumulate(Telemetry::TIME_BETWEEN_UNLABELED_RUNNABLES_MS, diff);
-            mLastUnlabeledRunnable = now;
-          }
-        }
-
-        if (mNextIdleDeadline) {
-          // If we construct the AutoTimer with the deadline, then we'll
-          // compute TimeStamp::Now() - mNextIdleDeadline when
-          // accumulating telemetry.  If that is positive we've
-          // overdrawn our idle budget, if it's negative it will go in
-          // the 0 bucket of the histogram.
-          idleTimer.emplace(name, mNextIdleDeadline);
-        }
-      }
-
       // If we're on the main thread, we want to record our current runnable's
       // name in a static so that BHR can record it.
       Array<char, kRunnableNameBufSize> restoreRunnableName;
       restoreRunnableName[0] = '\0';
       auto clear = MakeScopeExit([&] {
         if (MAIN_THREAD == mIsMainThread) {
           MOZ_ASSERT(NS_IsMainThread());
           sMainThreadRunnableName = restoreRunnableName;
         }
       });
       if (MAIN_THREAD == mIsMainThread) {
+        nsAutoCString name;
+        GetLabeledRunnableName(event, name, priority);
+
         MOZ_ASSERT(NS_IsMainThread());
         restoreRunnableName = sMainThreadRunnableName;
 
         // Copy the name into sMainThreadRunnableName's buffer, and append a
         // terminating null.
         uint32_t length = std::min((uint32_t) kRunnableNameBufSize - 1,
                                    (uint32_t) name.Length());
         memcpy(sMainThreadRunnableName.begin(), name.BeginReading(), length);
--- a/xpcom/threads/nsThread.h
+++ b/xpcom/threads/nsThread.h
@@ -168,20 +168,16 @@ protected:
   // The shutdown context for ourselves.
   struct nsThreadShutdownContext* mShutdownContext;
   // The shutdown contexts for any other threads we've asked to shut down.
   nsTArray<nsAutoPtr<struct nsThreadShutdownContext>> mRequestedShutdownContexts;
 
   mozilla::Atomic<bool> mShutdownRequired;
   MainThreadFlag mIsMainThread;
 
-  // The time when we last ran an unlabeled runnable (one not associated with a
-  // SchedulerGroup).
-  mozilla::TimeStamp mLastUnlabeledRunnable;
-
   // Set to true if this thread creates a JSRuntime.
   bool mCanInvokeJS;
 
   bool GetSchedulerLoggingEnabled();
   mozilla::TimeStamp mNextIdleDeadline;
   // Used to track which event is being executed by ProcessNextEvent
   nsCOMPtr<nsIRunnable> mCurrentEvent;
   mozilla::TimeStamp mCurrentEventStart;