Bug 828228 - Measure nsSearchService init with Telemetry. r=gavin

This commit is contained in:
David Rajchenbach-Teller 2013-01-16 18:03:05 -05:00
parent 3cb64f9dbd
commit dd4235ccf1
2 changed files with 19 additions and 0 deletions

View File

@ -16,6 +16,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
// A text encoder to UTF8, used whenever we commit the
// engine metadata to disk.
@ -2577,6 +2579,7 @@ SearchService.prototype = {
if (!getBoolPref(BROWSER_SEARCH_PREF + "cache.enabled", true))
return;
TelemetryStopwatch.start("SEARCH_SERVICE_BUILD_CACHE_MS");
let cache = {};
let locale = getLocale();
let buildID = Services.appinfo.platformBuildID;
@ -2658,6 +2661,7 @@ SearchService.prototype = {
} catch (ex) {
LOG("_buildCache: Could not write to cache file: " + ex);
}
TelemetryStopwatch.finish("SEARCH_SERVICE_BUILD_CACHE_MS");
},
_syncLoadEngines: function SRCH_SVC__syncLoadEngines() {
@ -3232,6 +3236,7 @@ SearchService.prototype = {
init: function SRCH_SVC_init(observer) {
let self = this;
if (!this._initStarted) {
TelemetryStopwatch.start("SEARCH_SERVICE_INIT_MS");
this._initStarted = true;
TaskUtils.spawn(function task() {
try {
@ -3246,8 +3251,10 @@ SearchService.prototype = {
// Future versions might introduce an actually synchronous
// implementation.
self._syncInit();
TelemetryStopwatch.finish("SEARCH_SERVICE_INIT_MS");
} catch (ex) {
self._initObservers.reject(ex);
TelemetryStopwatch.cancel("SEARCH_SERVICE_INIT_MS");
}
});
}

View File

@ -2502,6 +2502,18 @@
"n_values": 100,
"description": "Security UI Telemetry"
},
"SEARCH_SERVICE_INIT_MS": {
"kind": "exponential",
"high": "1000",
"n_buckets": 15,
"description": "Time (ms) it takes to initialize the search service"
},
"SEARCH_SERVICE_BUILD_CACHE_MS": {
"kind": "exponential",
"high": "1000",
"n_buckets": 15,
"description": "Time (ms) it takes to build the cache of the search service"
},
"SOCIAL_ENABLED_ON_SESSION": {
"kind": "flag",
"description": "Social has been enabled at least once on the current session"