From f6fc88cc2de85a5b0b496a8bb989f24bacbdb36c Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Tue, 8 Mar 2011 19:27:30 -0500 Subject: [PATCH] perf: Add metrics for switching to the applications view Measure how long it takes to switch from the workspaces view to the windows view the first time and the second time. https://bugzilla.gnome.org/show_bug.cgi?id=644266 --- js/perf/core.js | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/js/perf/core.js b/js/perf/core.js index 3ed7924f8..7d141a2d1 100644 --- a/js/perf/core.js +++ b/js/perf/core.js @@ -44,7 +44,13 @@ let METRICS = { units: "B" }, leakedAfterOverview: { description: "Additional malloc'ed bytes the second time the overview is shown", - units: "B" } + units: "B" }, + applicationsShowTimeFirst: + { description: "Time to switch to applications view, first time", + units: "us" }, + applicationsShowTimeSubsequent: + { description: "Time to switch to applications view, second time", + units: "us"} }; let WINDOW_CONFIGS = [ @@ -61,6 +67,8 @@ function run() { Scripting.defineScriptEvent("overviewShowStart", "Starting to show the overview"); Scripting.defineScriptEvent("overviewShowDone", "Overview finished showing"); Scripting.defineScriptEvent("afterShowHide", "After a show/hide cycle for the overview"); + Scripting.defineScriptEvent("applicationsShowStart", "Starting to switch to applications view"); + Scripting.defineScriptEvent("applicationsShowDone", "Done switching to applications view"); Main.overview.connect('shown', function() { Scripting.scriptEvent('overviewShowDone'); @@ -96,6 +104,21 @@ function run() { Scripting.collectStatistics(); Scripting.scriptEvent('afterShowHide'); } + + yield Scripting.destroyTestWindows(); + yield Scripting.sleep(1000); + + Main.overview.show(); + yield Scripting.waitLeisure(); + + for (let i = 0; i < 2; i++) { + Scripting.scriptEvent('applicationsShowStart'); + Main.overview.viewSelector.switchTab('applications'); + yield Scripting.waitLeisure(); + Scripting.scriptEvent('applicationsShowDone'); + Main.overview.viewSelector.switchTab('windows'); + yield Scripting.waitLeisure(); + } } let showingOverview = false; @@ -107,6 +130,8 @@ let mallocUsedSize = 0; let overviewShowCount = 0; let firstOverviewUsedSize; let haveSwapComplete = false; +let applicationsShowStart; +let applicationsShowCount = 0; function script_overviewShowStart(time) { showingOverview = true; @@ -122,6 +147,18 @@ function script_overviewShowDone(time) { finishedShowingOverview = true; } +function script_applicationsShowStart(time) { + applicationsShowStart = time; +} + +function script_applicationsShowDone(time) { + applicationsShowCount++; + if (applicationsShowCount == 1) + METRICS.applicationsShowTimeFirst.value = time - applicationsShowStart; + else + METRICS.applicationsShowTimeSubsequent.value = time - applicationsShowStart; +} + function script_afterShowHide(time) { if (overviewShowCount == 1) { METRICS.usedAfterOverview.value = mallocUsedSize;