Bug 1417107 - Use histogram key suffix 'unlabeled' instead of 'labeled'. r=erahm
authorAndreas Farre <farre@mozilla.com>
Tue, 14 Nov 2017 20:52:32 +0100
changeset 448288 4f2cfc8012f11fa005261948d86a9162b2fe6e89
parent 448287 4c3feee4dfd2d0efac06bf03c872cffd6f89ddc9
child 448289 96ba7b1e3254efb869040f1ba98d9f586df6ff4c
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1417107
milestone59.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 1417107 - Use histogram key suffix 'unlabeled' instead of 'labeled'. r=erahm Make unlabeled runnables be the runnables we tag with extra information, since they're the ones we want to decrease. Note: This changes values gathered for telemetry!
toolkit/components/telemetry/Histograms.json
xpcom/threads/SchedulerGroup.cpp
xpcom/threads/nsThread.cpp
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -13194,17 +13194,17 @@
     "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"],
+    "alert_emails": ["wmccloskey@mozilla.com", "farre@mozilla.com"],
     "expires_in_version": "60",
     "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."
   },
--- a/xpcom/threads/SchedulerGroup.cpp
+++ b/xpcom/threads/SchedulerGroup.cpp
@@ -373,17 +373,16 @@ SchedulerGroup::Runnable::GetName(nsACSt
   nsCOMPtr<nsINamed> named = do_QueryInterface(mRunnable);
   if (named) {
     named->GetName(aName);
   }
   if (aName.IsEmpty()) {
     aName.AssignLiteral("anonymous");
   }
 
-  aName.AppendASCII("(labeled)");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 SchedulerGroup::Runnable::Run()
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
 
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -879,31 +879,37 @@ void canary_alarm_handler(int signum)
         obs_ = iter_.GetNext();                                                \
         obs_ -> func_ params_ ;                                                \
       }                                                                        \
     }                                                                          \
   } while(0)
 
 #ifndef RELEASE_OR_BETA
 static bool
-GetLabeledRunnableName(nsIRunnable* aEvent, nsACString& aName)
+GetLabeledRunnableName(nsIRunnable* aEvent,
+                       nsACString& aName,
+                       EventPriority aPriority)
 {
   bool labeled = false;
   if (RefPtr<SchedulerGroup::Runnable> groupRunnable = do_QueryObject(aEvent)) {
     labeled = true;
     MOZ_ALWAYS_TRUE(NS_SUCCEEDED(groupRunnable->GetName(aName)));
   } else if (nsCOMPtr<nsINamed> named = do_QueryInterface(aEvent)) {
     MOZ_ALWAYS_TRUE(NS_SUCCEEDED(named->GetName(aName)));
   } else {
     aName.AssignLiteral("non-nsINamed runnable");
   }
   if (aName.IsEmpty()) {
     aName.AssignLiteral("anonymous runnable");
   }
 
+  if (!labeled && aPriority > EventPriority::Input) {
+    aName.AppendLiteral("(unlabeled)");
+  }
+
   return labeled;
 }
 #endif
 
 NS_IMETHODIMP
 nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
 {
   LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait,
@@ -974,17 +980,17 @@ nsThread::ProcessNextEvent(bool aMayWait
       }
 
 #ifndef RELEASE_OR_BETA
       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);
+        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) {
             TimeStamp now = TimeStamp::Now();