diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js index cb9f4c538f..5f0a620522 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js @@ -1294,6 +1294,7 @@ this.$.reporting.time(CHANGE_DATA_TIMING_LABEL); Promise.all(allDataPromises).then(() => { this.$.reporting.timeEnd(CHANGE_DATA_TIMING_LABEL); + this.$.reporting.changeFullyLoaded(); }); return coreDataPromise diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js index 63808d1f1d..df18fda72e 100644 --- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js +++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js @@ -70,11 +70,13 @@ const TIMER = { CHANGE_DISPLAYED: 'ChangeDisplayed', + CHANGE_LOAD_FULL: 'ChangeFullyLoaded', DASHBOARD_DISPLAYED: 'DashboardDisplayed', DIFF_VIEW_DISPLAYED: 'DiffViewDisplayed', FILE_LIST_DISPLAYED: 'FileListDisplayed', PLUGINS_LOADED: 'PluginsLoaded', STARTUP_CHANGE_DISPLAYED: 'StartupChangeDisplayed', + STARTUP_CHANGE_LOAD_FULL: 'StartupChangeFullyLoaded', STARTUP_DASHBOARD_DISPLAYED: 'StartupDashboardDisplayed', STARTUP_DIFF_VIEW_DISPLAYED: 'StartupDiffViewDisplayed', STARTUP_FILE_LIST_DISPLAYED: 'StartupFileListDisplayed', @@ -84,6 +86,7 @@ const STARTUP_TIMERS = {}; STARTUP_TIMERS[TIMER.PLUGINS_LOADED] = 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_DIFF_VIEW_DISPLAYED] = 0; STARTUP_TIMERS[TIMER.STARTUP_FILE_LIST_DISPLAYED] = 0; @@ -225,6 +228,7 @@ delete this._baselines[prop]; } this.time(TIMER.CHANGE_DISPLAYED); + this.time(TIMER.CHANGE_LOAD_FULL); this.time(TIMER.DASHBOARD_DISPLAYED); this.time(TIMER.DIFF_VIEW_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() { if (this._baselines.hasOwnProperty(TIMER.STARTUP_DIFF_VIEW_DISPLAYED)) { this.timeEnd(TIMER.STARTUP_DIFF_VIEW_DISPLAYED); diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html index 5849042433..f0440d24d2 100644 --- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html +++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html @@ -100,6 +100,7 @@ limitations under the License. 'lifecycle', 'UI Latency', 'Jank count', 42)); assert.isTrue(element.time.calledWithExactly('DashboardDisplayed')); assert.isTrue(element.time.calledWithExactly('ChangeDisplayed')); + assert.isTrue(element.time.calledWithExactly('ChangeFullyLoaded')); assert.isTrue(element.time.calledWithExactly('DiffViewDisplayed')); assert.isTrue(element.time.calledWithExactly('FileListDisplayed')); assert.isFalse(element._baselines.hasOwnProperty('garbage')); @@ -116,6 +117,17 @@ limitations under the License. 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', () => { sandbox.spy(element, 'timeEnd'); element.diffViewDisplayed();