Bug 1167292 - Part 1: Add a telemetry probe to time how long it takes to save a heap snapshot; r=ejpbruel

This commit is contained in:
Nick Fitzgerald 2015-07-21 12:35:58 -07:00
Родитель a5268caf0a
Коммит d36ea2dd77
2 изменённых файлов: 20 добавлений и 6 удалений

Просмотреть файл

@ -7078,6 +7078,13 @@
"n_buckets": "100",
"description": "The mean number of pinned tabs (app tabs) in all windows for a session for devtools users."
},
"DEVTOOLS_SAVE_HEAP_SNAPSHOT_MS": {
"expires_in_version": "never",
"kind": "exponential",
"high": "100000",
"n_buckets": "1000",
"description": "The time (in milliseconds) that it took to save a heap snapshot in mozilla::devtools::ChromeUtils::SaveHeapSnapshot."
},
"BROWSER_IS_USER_DEFAULT": {
"expires_in_version": "never",
"kind": "boolean",

Просмотреть файл

@ -19,6 +19,8 @@
#include "mozilla/devtools/ZeroCopyNSIOutputStream.h"
#include "mozilla/dom/ChromeUtils.h"
#include "mozilla/dom/HeapSnapshotBinding.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
#include "jsapi.h"
@ -550,6 +552,8 @@ ThreadSafeChromeUtils::SaveHeapSnapshot(GlobalObject& global,
const HeapSnapshotBoundaries& boundaries,
ErrorResult& rv)
{
auto start = TimeStamp::Now();
bool wantNames = true;
ZoneSet zones;
Maybe<AutoCheckCannotGC> maybeNoGC;
@ -587,12 +591,15 @@ ThreadSafeChromeUtils::SaveHeapSnapshot(GlobalObject& global,
wantNames,
zones.initialized() ? &zones : nullptr,
maybeNoGC.ref()))
{
rv.Throw(zeroCopyStream.failed()
? zeroCopyStream.result()
: NS_ERROR_UNEXPECTED);
return;
}
{
rv.Throw(zeroCopyStream.failed()
? zeroCopyStream.result()
: NS_ERROR_UNEXPECTED);
return;
}
Telemetry::AccumulateTimeDelta(Telemetry::DEVTOOLS_SAVE_HEAP_SNAPSHOT_MS,
start);
}
/* static */ already_AddRefed<HeapSnapshot>