Basilisk: Remove TelemetryStopwatch

This commit is contained in:
Gaming4JC 2018-08-19 18:18:36 -04:00 committed by Roy Tam
commit 4c5dd3bcf8
14 changed files with 8 additions and 212 deletions

View file

@ -37,8 +37,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {
const kBrandBundle = "chrome://branding/locale/brand.properties";
@ -211,7 +209,6 @@ const AutoMigrate = {
undo: Task.async(function* () {
let browserId = Preferences.get(kAutoMigrateBrowserPref, "unknown");
TelemetryStopwatch.startKeyed("FX_STARTUP_MIGRATION_UNDO_TOTAL_MS", browserId);
let histogram = Services.telemetry.getHistogramById("FX_STARTUP_MIGRATION_AUTOMATED_IMPORT_UNDO");
histogram.add(0);
if (!(yield this.canUndo())) {
@ -236,38 +233,24 @@ const AutoMigrate = {
Services.telemetry.getKeyedHistogramById(histogramId).add(browserId, this._errorMap[type]);
};
let startTelemetryStopwatch = resourceType => {
let histogramId = `FX_STARTUP_MIGRATION_UNDO_${resourceType.toUpperCase()}_MS`;
TelemetryStopwatch.startKeyed(histogramId, browserId);
};
let stopTelemetryStopwatch = resourceType => {
let histogramId = `FX_STARTUP_MIGRATION_UNDO_${resourceType.toUpperCase()}_MS`;
TelemetryStopwatch.finishKeyed(histogramId, browserId);
};
startTelemetryStopwatch("bookmarks");
yield this._removeUnchangedBookmarks(stateData.get("bookmarks")).catch(ex => {
Cu.reportError("Uncaught exception when removing unchanged bookmarks!");
Cu.reportError(ex);
});
stopTelemetryStopwatch("bookmarks");
reportErrorTelemetry("bookmarks");
histogram.add(15);
startTelemetryStopwatch("visits");
yield this._removeSomeVisits(stateData.get("visits")).catch(ex => {
Cu.reportError("Uncaught exception when removing history visits!");
Cu.reportError(ex);
});
stopTelemetryStopwatch("visits");
reportErrorTelemetry("visits");
histogram.add(20);
startTelemetryStopwatch("logins");
yield this._removeUnchangedLogins(stateData.get("logins")).catch(ex => {
Cu.reportError("Uncaught exception when removing unchanged logins!");
Cu.reportError(ex);
});
stopTelemetryStopwatch("logins");
reportErrorTelemetry("logins");
histogram.add(25);
@ -278,7 +261,6 @@ const AutoMigrate = {
this._purgeUndoState(this.UNDO_REMOVED_REASON_UNDO_USED);
histogram.add(30);
TelemetryStopwatch.finishKeyed("FX_STARTUP_MIGRATION_UNDO_TOTAL_MS", browserId);
}),
_removeNotificationBars() {

View file

@ -32,8 +32,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "ResponsivenessMonitor",
"resource://gre/modules/ResponsivenessMonitor.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Sqlite",
"resource://gre/modules/Sqlite.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry",
"resource://gre/modules/WindowsRegistry.jsm");
@ -254,14 +252,6 @@ this.MigratorPrototype = {
let browserKey = this.getBrowserKey();
let maybeStartTelemetryStopwatch = resourceType => {
let histogramId = getHistogramIdForResourceType(resourceType, "FX_MIGRATION_*_IMPORT_MS");
if (histogramId) {
TelemetryStopwatch.startKeyed(histogramId, browserKey);
}
return histogramId;
};
let maybeStartResponsivenessMonitor = resourceType => {
let responsivenessMonitor;
let responsivenessHistogramId =
@ -323,8 +313,6 @@ this.MigratorPrototype = {
for (let [migrationType, itemResources] of resourcesGroupedByItems) {
notify("Migration:ItemBeforeMigrate", migrationType);
let stopwatchHistogramId = maybeStartTelemetryStopwatch(migrationType);
let {responsivenessMonitor, responsivenessHistogramId} =
maybeStartResponsivenessMonitor(migrationType);
@ -340,10 +328,6 @@ this.MigratorPrototype = {
migrationType);
resourcesGroupedByItems.delete(migrationType);
if (stopwatchHistogramId) {
TelemetryStopwatch.finishKeyed(stopwatchHistogramId, browserKey);
}
maybeFinishResponsivenessMonitor(responsivenessMonitor, responsivenessHistogramId);
if (resourcesGroupedByItems.size == 0) {

View file

@ -3,8 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/TelemetryStopwatch.jsm");
var gHistoryTree;
var gSearchBox;
var gHistoryGrouping = "";
@ -81,16 +79,11 @@ function searchHistory(aInput)
options.resultType = resultType;
options.includeHidden = !!aInput;
if (gHistoryGrouping == "lastvisited")
this.TelemetryStopwatch.start("HISTORY_LASTVISITED_TREE_QUERY_TIME_MS");
// call load() on the tree manually
// instead of setting the place attribute in history-panel.xul
// otherwise, we will end up calling load() twice
gHistoryTree.load([query], options);
if (gHistoryGrouping == "lastvisited")
this.TelemetryStopwatch.finish("HISTORY_LASTVISITED_TREE_QUERY_TIME_MS");
}
window.addEventListener("SidebarFocused",

View file

@ -5,7 +5,6 @@
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "MigrationUtils",
"resource:///modules/MigrationUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
@ -810,9 +809,7 @@ var PlacesSearchBox = {
currentView.load([query], options);
}
else {
TelemetryStopwatch.start(HISTORY_LIBRARY_SEARCH_TELEMETRY);
currentView.applyFilter(filterString, null, true);
TelemetryStopwatch.finish(HISTORY_LIBRARY_SEARCH_TELEMETRY);
}
break;
case "downloads":

View file

@ -43,8 +43,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
"resource://gre/modules/PromiseUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RunState",
"resource:///modules/sessionstore/RunState.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "Telemetry",

View file

@ -13,7 +13,6 @@ const Ci = Components.interfaces;
Cu.import("resource://gre/modules/Timer.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
@ -52,19 +51,6 @@ function notify(subject, topic) {
Services.obs.notifyObservers(subject, topic, "");
}
// TelemetryStopwatch helper functions.
function stopWatch(method) {
return function (...histograms) {
for (let hist of histograms) {
TelemetryStopwatch[method]("FX_SESSION_RESTORE_" + hist);
}
};
}
var stopWatchStart = stopWatch("start");
var stopWatchCancel = stopWatch("cancel");
var stopWatchFinish = stopWatch("finish");
/**
* The external API implemented by the SessionSaver module.
*/
@ -182,7 +168,6 @@ var SessionSaverInternal = {
return Promise.resolve();
}
stopWatchStart("COLLECT_DATA_MS", "COLLECT_DATA_LONGEST_OP_MS");
let state = SessionStore.getCurrentState(forceUpdateAllWindows);
PrivacyFilter.filterPrivateWindowsAndTabs(state);
@ -226,7 +211,6 @@ var SessionSaverInternal = {
}
}
stopWatchFinish("COLLECT_DATA_MS", "COLLECT_DATA_LONGEST_OP_MS");
return this._writeState(state);
},

View file

@ -135,7 +135,6 @@ Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm", this);
Cu.import("resource://gre/modules/Promise.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
Cu.import("resource://gre/modules/TelemetryTimestamps.jsm", this);
Cu.import("resource://gre/modules/Timer.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
@ -564,7 +563,6 @@ var SessionStoreInternal = {
* Initialize the session using the state provided by SessionStartup
*/
initSession: function () {
TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS");
let state;
let ss = gSessionStartup;
@ -640,7 +638,6 @@ var SessionStoreInternal = {
this._prefBranch.getBoolPref("sessionstore.resume_session_once"))
this._prefBranch.setBoolPref("sessionstore.resume_session_once", false);
TelemetryStopwatch.finish("FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS");
return state;
},
@ -1247,9 +1244,7 @@ var SessionStoreInternal = {
if (initialState) {
Services.obs.notifyObservers(null, NOTIFY_RESTORING_ON_STARTUP, "");
}
TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");
this.initializeWindow(aWindow, initialState);
TelemetryStopwatch.finish("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");
// Let everyone know we're done.
this._deferredInitialized.resolve();
@ -2857,7 +2852,6 @@ var SessionStoreInternal = {
var activeWindow = this._getMostRecentBrowserWindow();
TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");
if (RunState.isRunning) {
// update the data for all windows with activities since the last save operation
this._forEachBrowserWindow(function(aWindow) {
@ -2872,7 +2866,6 @@ var SessionStoreInternal = {
});
DirtyWindows.clear();
}
TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");
// An array that at the end will hold all current window data.
var total = [];
@ -2892,9 +2885,7 @@ var SessionStoreInternal = {
nonPopupCount++;
}
TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");
SessionCookies.update(total);
TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");
// collect the data for all windows yet to be restored
for (ix in this._statesToRestore) {
@ -3063,8 +3054,6 @@ var SessionStoreInternal = {
if (aWindow && (!aWindow.__SSi || !this._windows[aWindow.__SSi]))
this.onLoad(aWindow);
TelemetryStopwatch.start("FX_SESSION_RESTORE_RESTORE_WINDOW_MS");
// We're not returning from this before we end up calling restoreTabs
// for this window, so make sure we send the SSWindowStateBusy event.
this._setWindowStateBusy(aWindow);
@ -3235,8 +3224,6 @@ var SessionStoreInternal = {
// set smoothScroll back to the original value
tabstrip.smoothScroll = smoothScroll;
TelemetryStopwatch.finish("FX_SESSION_RESTORE_RESTORE_WINDOW_MS");
this._setWindowStateReady(aWindow);
this._sendWindowRestoredNotification(aWindow);

View file

@ -37,7 +37,6 @@ const Cr = Components.results;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
Cu.import("resource://gre/modules/Promise.jsm");