[gnome-shell] perf: Add metrics for switching to the applications view



commit f6fc88cc2de85a5b0b496a8bb989f24bacbdb36c
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Tue Mar 8 19:27:30 2011 -0500

    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 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/js/perf/core.js b/js/perf/core.js
index 3ed7924..7d141a2 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]