mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 1331804 - Measure runnable times keyed by name for telemetry (r=ehsan,bsmedberg)
MozReview-Commit-ID: FQmJKwEgBdv
This commit is contained in:
parent
e6591c65cb
commit
397131ee0d
@ -10634,5 +10634,15 @@
|
||||
"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": {
|
||||
"alert_emails": ["wmccloskey@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."
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,17 @@ interface nsINamed : nsISupports
|
||||
* A string describing the purpose of the runnable/timer/whatever. Useful
|
||||
* for debugging. This attribute is read-only, but you can change it to a
|
||||
* compile-time string literal with setName.
|
||||
*
|
||||
* WARNING: This attribute will be included in telemetry, so it should
|
||||
* never contain privacy sensitive information.
|
||||
*/
|
||||
readonly attribute ACString name;
|
||||
|
||||
/* Note: The string you pass in should be a compile-time literal. */
|
||||
/*
|
||||
* Note: The string you pass in should be a compile-time literal.
|
||||
*
|
||||
* WARNING: This value will be included in telemetry, so it should
|
||||
* never contain privacy sensitive information.
|
||||
*/
|
||||
[noscript] void setName(in string aName);
|
||||
};
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "mozilla/ChaosMode.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
@ -1237,8 +1238,23 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||
|
||||
if (event) {
|
||||
LOG(("THRD(%p) running [%p]\n", this, event.get()));
|
||||
#ifndef RELEASE_OR_BETA
|
||||
Maybe<Telemetry::AutoTimer<Telemetry::MAIN_THREAD_RUNNABLE_MS>> timer;
|
||||
#endif
|
||||
if (MAIN_THREAD == mIsMainThread) {
|
||||
HangMonitor::NotifyActivity();
|
||||
|
||||
#ifndef RELEASE_OR_BETA
|
||||
nsCString name;
|
||||
if (nsCOMPtr<nsINamed> named = do_QueryInterface(event)) {
|
||||
if (NS_FAILED(named->GetName(name))) {
|
||||
name.AssignLiteral("GetName failed");
|
||||
}
|
||||
} else {
|
||||
name.AssignLiteral("non-nsINamed runnable");
|
||||
}
|
||||
timer.emplace(name);
|
||||
#endif
|
||||
}
|
||||
event->Run();
|
||||
} else if (aMayWait) {
|
||||
|
Loading…
Reference in New Issue
Block a user