Bug 1198898 - Determining number of tabs/windows restored by Session Restore;r=mconley

--HG--
extra : rebase_source : cde8bcddcd2432691a820a37c942218cf01453b8
This commit is contained in:
David Rajchenbach-Teller 2015-11-26 18:13:20 +01:00
Родитель 877c534907
Коммит cdae8b5042
2 изменённых файлов: 37 добавлений и 1 удалений

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

@ -44,6 +44,11 @@ this.StartupPerformance = {
// `true` once the timer has fired
_hasFired: false,
// Statistics on the session we need to restore.
_totalNumberOfEagerTabs: 0,
_totalNumberOfTabs: 0,
_totalNumberOfWindows: 0,
init: function() {
for (let topic of TOPICS) {
Services.obs.addObserver(this, topic, false);
@ -55,6 +60,9 @@ this.StartupPerformance = {
// Behavior is unspecified if there was already an ongoing measure.
_onRestorationStarts: function(isAutoRestore) {
this._startTimeStamp = Date.now();
this._totalNumberOfEagerTabs = 0;
this._totalNumberOfTabs = 0;
this._totalNumberOfWindows = 0;
// While we may restore several sessions in a single run of the browser,
// that's a very unusual case, and not really worth measuring, so let's
@ -83,9 +91,14 @@ this.StartupPerformance = {
let delta = this._latestRestoredTimeStamp - this._startTimeStamp;
histogram.add(delta);
Services.telemetry.getHistogramById("FX_SESSION_RESTORE_NUMBER_OF_EAGER_TABS_RESTORED").add(this._totalNumberOfEagerTabs);
Services.telemetry.getHistogramById("FX_SESSION_RESTORE_NUMBER_OF_TABS_RESTORED").add(this._totalNumberOfTabs);
Services.telemetry.getHistogramById("FX_SESSION_RESTORE_NUMBER_OF_WINDOWS_RESTORED").add(this._totalNumberOfWindows);
// Reset
this._startTimeStamp = null;
} catch (ex) {
} catch (ex) {
console.error("StartupPerformance: error after resolving promise", ex);
}
});
@ -151,6 +164,8 @@ this.StartupPerformance = {
// Reset the delay, to give the tabs a little (more) time to restore.
this._startTimer();
this._totalNumberOfWindows += 1;
// Observe the restoration of all tabs. We assume that all tabs of this
// window will have been restored before `COLLECT_RESULTS_AFTER_MS`.
// The last call to `observer` will let us determine how long it took
@ -159,8 +174,10 @@ this.StartupPerformance = {
let observer = () => {
this._latestRestoredTimeStamp = Date.now();
this._totalNumberOfEagerTabs += 1;
};
win.gBrowser.tabContainer.addEventListener("SSTabRestored", observer);
this._totalNumberOfTabs += win.gBrowser.tabContainer.itemCount;
// Once we have finished collecting the results, clean up the observers.
this._promiseFinished.then(() => {

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

@ -4242,6 +4242,25 @@
"n_buckets": 20,
"description": "Session restore: If a session is restored by the user clicking on 'Restore Session', this probe measures the time elapsed between the instant the user has clicked and the instant we have finished restoring tabs eagerly. At this stage, the tabs that are restored on demand are not restored yet."
},
"FX_SESSION_RESTORE_NUMBER_OF_TABS_RESTORED": {
"expires_in_version": "default",
"kind": "exponential",
"high": "500",
"n_buckets": 20,
"description": "Session restore: Number of tabs in the session that has just been restored."
},
"FX_SESSION_RESTORE_NUMBER_OF_WINDOWS_RESTORED": {
"expires_in_version": "default",
"kind": "enumerated",
"n_values": "50",
"description": "Session restore: Number of windows in the session that has just been restored."
},
"FX_SESSION_RESTORE_NUMBER_OF_EAGER_TABS_RESTORED": {
"expires_in_version": "default",
"kind": "enumerated",
"n_values": "50",
"description": "Session restore: Number of tabs restored eagerly in the session that has just been restored."
},
"FX_TABLETMODE_PAGE_LOAD": {
"expires_in_version": "47",
"kind": "exponential",