Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: tools/perf/measurements/session_restore.py

Issue 313923003: [Telemetry] Fix race in session restore measurement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/measurements/session_restore.py
diff --git a/tools/perf/measurements/session_restore.py b/tools/perf/measurements/session_restore.py
index ff210b4f3b66e2d1be4cf800ffb98b351ccb0f1e..46d4019da83b7bb0a8307e3e96a9b5aa740a9820 100644
--- a/tools/perf/measurements/session_restore.py
+++ b/tools/perf/measurements/session_restore.py
@@ -1,13 +1,16 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
import collections
from measurements import startup
from metrics import cpu
+from metrics import histogram_util
from metrics import startup_metric
from telemetry.core import util
+
class SessionRestore(startup.Startup):
"""Performs a measurement of Chromium's Session restore performance.
@@ -23,14 +26,20 @@ class SessionRestore(startup.Startup):
def CustomizeBrowserOptions(self, options):
super(SessionRestore, self).CustomizeBrowserOptions(options)
+ histogram_util.CustomizeBrowserOptions(options)
options.AppendExtraBrowserArgs([
'--restore-last-session'
])
def TabForPage(self, page, browser):
# Detect that the session restore has completed.
- util.WaitFor(lambda: len(browser.tabs), 30)
- return browser.tabs[0]
+ util.WaitFor(lambda: browser.tabs and
+ histogram_util.GetHistogramCount(
+ histogram_util.BROWSER_HISTOGRAM,
+ 'SessionRestore.AllTabsLoaded',
+ browser.foreground_tab),
jeremy 2014/06/05 10:39:04 Very nice!!!
+ 30)
+ return browser.foreground_tab
def CanRunForPage(self, page):
# No matter how many pages in the pageset, just perform one test iteration.
@@ -59,7 +68,7 @@ class SessionRestore(startup.Startup):
self._cpu_metric.Start(None, None)
def MeasurePage(self, page, tab, results):
- tab.browser.foreground_tab.WaitForDocumentReadyStateToBeComplete()
+ tab.WaitForDocumentReadyStateToBeComplete()
# Record CPU usage from browser start to when the foreground page is loaded.
self._cpu_metric.Stop(None, None)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698