Merge "Measure change fully-loaded time from navigation time"

This commit is contained in:
Wyatt Allen
2018-05-31 03:01:07 +00:00
committed by Gerrit Code Review
3 changed files with 25 additions and 0 deletions

View File

@@ -1294,6 +1294,7 @@
this.$.reporting.time(CHANGE_DATA_TIMING_LABEL); this.$.reporting.time(CHANGE_DATA_TIMING_LABEL);
Promise.all(allDataPromises).then(() => { Promise.all(allDataPromises).then(() => {
this.$.reporting.timeEnd(CHANGE_DATA_TIMING_LABEL); this.$.reporting.timeEnd(CHANGE_DATA_TIMING_LABEL);
this.$.reporting.changeFullyLoaded();
}); });
return coreDataPromise return coreDataPromise

View File

@@ -70,11 +70,13 @@
const TIMER = { const TIMER = {
CHANGE_DISPLAYED: 'ChangeDisplayed', CHANGE_DISPLAYED: 'ChangeDisplayed',
CHANGE_LOAD_FULL: 'ChangeFullyLoaded',
DASHBOARD_DISPLAYED: 'DashboardDisplayed', DASHBOARD_DISPLAYED: 'DashboardDisplayed',
DIFF_VIEW_DISPLAYED: 'DiffViewDisplayed', DIFF_VIEW_DISPLAYED: 'DiffViewDisplayed',
FILE_LIST_DISPLAYED: 'FileListDisplayed', FILE_LIST_DISPLAYED: 'FileListDisplayed',
PLUGINS_LOADED: 'PluginsLoaded', PLUGINS_LOADED: 'PluginsLoaded',
STARTUP_CHANGE_DISPLAYED: 'StartupChangeDisplayed', STARTUP_CHANGE_DISPLAYED: 'StartupChangeDisplayed',
STARTUP_CHANGE_LOAD_FULL: 'StartupChangeFullyLoaded',
STARTUP_DASHBOARD_DISPLAYED: 'StartupDashboardDisplayed', STARTUP_DASHBOARD_DISPLAYED: 'StartupDashboardDisplayed',
STARTUP_DIFF_VIEW_DISPLAYED: 'StartupDiffViewDisplayed', STARTUP_DIFF_VIEW_DISPLAYED: 'StartupDiffViewDisplayed',
STARTUP_FILE_LIST_DISPLAYED: 'StartupFileListDisplayed', STARTUP_FILE_LIST_DISPLAYED: 'StartupFileListDisplayed',
@@ -84,6 +86,7 @@
const STARTUP_TIMERS = {}; const STARTUP_TIMERS = {};
STARTUP_TIMERS[TIMER.PLUGINS_LOADED] = 0; STARTUP_TIMERS[TIMER.PLUGINS_LOADED] = 0;
STARTUP_TIMERS[TIMER.STARTUP_CHANGE_DISPLAYED] = 0; STARTUP_TIMERS[TIMER.STARTUP_CHANGE_DISPLAYED] = 0;
STARTUP_TIMERS[TIMER.STARTUP_CHANGE_LOAD_FULL] = 0;
STARTUP_TIMERS[TIMER.STARTUP_DASHBOARD_DISPLAYED] = 0; STARTUP_TIMERS[TIMER.STARTUP_DASHBOARD_DISPLAYED] = 0;
STARTUP_TIMERS[TIMER.STARTUP_DIFF_VIEW_DISPLAYED] = 0; STARTUP_TIMERS[TIMER.STARTUP_DIFF_VIEW_DISPLAYED] = 0;
STARTUP_TIMERS[TIMER.STARTUP_FILE_LIST_DISPLAYED] = 0; STARTUP_TIMERS[TIMER.STARTUP_FILE_LIST_DISPLAYED] = 0;
@@ -225,6 +228,7 @@
delete this._baselines[prop]; delete this._baselines[prop];
} }
this.time(TIMER.CHANGE_DISPLAYED); this.time(TIMER.CHANGE_DISPLAYED);
this.time(TIMER.CHANGE_LOAD_FULL);
this.time(TIMER.DASHBOARD_DISPLAYED); this.time(TIMER.DASHBOARD_DISPLAYED);
this.time(TIMER.DIFF_VIEW_DISPLAYED); this.time(TIMER.DIFF_VIEW_DISPLAYED);
this.time(TIMER.FILE_LIST_DISPLAYED); this.time(TIMER.FILE_LIST_DISPLAYED);
@@ -251,6 +255,14 @@
} }
}, },
changeFullyLoaded() {
if (this._baselines.hasOwnProperty(TIMER.STARTUP_CHANGE_LOAD_FULL)) {
this.timeEnd(TIMER.STARTUP_CHANGE_LOAD_FULL);
} else {
this.timeEnd(TIMER.CHANGE_LOAD_FULL);
}
},
diffViewDisplayed() { diffViewDisplayed() {
if (this._baselines.hasOwnProperty(TIMER.STARTUP_DIFF_VIEW_DISPLAYED)) { if (this._baselines.hasOwnProperty(TIMER.STARTUP_DIFF_VIEW_DISPLAYED)) {
this.timeEnd(TIMER.STARTUP_DIFF_VIEW_DISPLAYED); this.timeEnd(TIMER.STARTUP_DIFF_VIEW_DISPLAYED);

View File

@@ -100,6 +100,7 @@ limitations under the License.
'lifecycle', 'UI Latency', 'Jank count', 42)); 'lifecycle', 'UI Latency', 'Jank count', 42));
assert.isTrue(element.time.calledWithExactly('DashboardDisplayed')); assert.isTrue(element.time.calledWithExactly('DashboardDisplayed'));
assert.isTrue(element.time.calledWithExactly('ChangeDisplayed')); assert.isTrue(element.time.calledWithExactly('ChangeDisplayed'));
assert.isTrue(element.time.calledWithExactly('ChangeFullyLoaded'));
assert.isTrue(element.time.calledWithExactly('DiffViewDisplayed')); assert.isTrue(element.time.calledWithExactly('DiffViewDisplayed'));
assert.isTrue(element.time.calledWithExactly('FileListDisplayed')); assert.isTrue(element.time.calledWithExactly('FileListDisplayed'));
assert.isFalse(element._baselines.hasOwnProperty('garbage')); assert.isFalse(element._baselines.hasOwnProperty('garbage'));
@@ -116,6 +117,17 @@ limitations under the License.
assert.isTrue(element.timeEnd.calledWithExactly('ChangeDisplayed')); assert.isTrue(element.timeEnd.calledWithExactly('ChangeDisplayed'));
}); });
test('changeFullyLoaded', () => {
sandbox.spy(element, 'timeEnd');
element.changeFullyLoaded();
assert.isFalse(
element.timeEnd.calledWithExactly('ChangeFullyLoaded'));
assert.isTrue(
element.timeEnd.calledWithExactly('StartupChangeFullyLoaded'));
element.changeFullyLoaded();
assert.isTrue(element.timeEnd.calledWithExactly('ChangeFullyLoaded'));
});
test('diffViewDisplayed', () => { test('diffViewDisplayed', () => {
sandbox.spy(element, 'timeEnd'); sandbox.spy(element, 'timeEnd');
element.diffViewDisplayed(); element.diffViewDisplayed();