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

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

Issue 2766533002: Using multi-tab story in TabSwitching Benchmark (Closed)
Patch Set: Use the new story for TabSwitching Benchmark Created 3 years, 9 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 | « tools/perf/benchmarks/tab_switching.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/measurements/tab_switching.py
diff --git a/tools/perf/measurements/tab_switching.py b/tools/perf/measurements/tab_switching.py
index dd64dfa0d2f583d17afc72b67146ef3b9351c045..b041266600820c95a18032c5b27330ecca193a8b 100644
--- a/tools/perf/measurements/tab_switching.py
+++ b/tools/perf/measurements/tab_switching.py
@@ -121,3 +121,60 @@ class TabSwitching(legacy_page_test.LegacyPageTest):
def DidRunPage(self, platform):
del platform # unused
self._power_metric.Close()
+
+class TabSwitching2(legacy_page_test.LegacyPageTest):
+ # Amount of time to measure, in seconds.
+ SAMPLE_TIME = 30
+
+ def __init__(self):
+ super(TabSwitching2, self).__init__()
+ self._power_metric = None
+ self._first_histogram = None
+
+ def CustomizeBrowserOptions(self, options):
+ keychain_metric.KeychainMetric.CustomizeBrowserOptions(options)
+
+ options.AppendExtraBrowserArgs(['--enable-stats-collection-bindings'])
+
+ # Enable background networking so we can test its impact on power usage.
+ options.disable_background_networking = False
+ power.PowerMetric.CustomizeBrowserOptions(options)
+
+ def WillStartBrowser(self, platform):
+ self._power_metric = power.PowerMetric(platform, TabSwitching.SAMPLE_TIME)
+
+ @classmethod
+ def _GetTabSwitchHistogram(cls, tab_to_switch):
+ histogram_name = 'MPArch.RWH_TabSwitchPaintDuration'
+ histogram_type = histogram_util.BROWSER_HISTOGRAM
+ return histogram_util.GetHistogram(
+ histogram_type, histogram_name, tab_to_switch)
+
+ def DidNavigateToPage(self, page, tab):
+ """record the starting histogram"""
+ self._first_histogram = self._GetTabSwitchHistogram(tab)
+
+ def ValidateAndMeasurePage(self, page, tab, results):
+ """record the ending histogram for the tab switching metric."""
+ if tab.browser.platform.CanMonitorPower():
+ self._power_metric.Start(page, tab)
+ time.sleep(TabSwitching.SAMPLE_TIME)
+ self._power_metric.Stop(page, tab)
+ self._power_metric.AddResults(tab, results,)
+
+ last_histogram = self._GetTabSwitchHistogram(tab)
+ total_diff_histogram = histogram_util.SubtractHistogram(last_histogram,
+ self._first_histogram)
+
+ display_name = 'MPArch_RWH_TabSwitchPaintDuration'
+ results.AddSummaryValue(
+ histogram.HistogramValue(None, display_name, 'ms',
+ raw_value_json=total_diff_histogram,
+ important=False))
+
+ keychain_metric.KeychainMetric().AddResults(tab, results)
+
+ def DidRunPage(self, platform):
+ del platform # unused
+ self._power_metric.Close()
nednguyen 2017/03/21 14:46:12 Can you remove the legacy power_metric? The old po
vovoy 2017/03/23 09:37:49 Done.
+
« no previous file with comments | « tools/perf/benchmarks/tab_switching.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698