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

Side by Side Diff: tools/perf/contrib/cros_benchmarks/tab_switching_measure.py

Issue 2890333002: Tab Switching Benchmark for ChromeOS (Closed)
Patch Set: Minor fixes. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """The tab switching measurement.
6
7 This measurement record the MPArch.RWH_TabSwitchPaintDuration histogram
8 of each tab swithcing.
9 """
10
11 from telemetry.page import legacy_page_test
12 from telemetry.value import histogram
13 from telemetry.value import histogram_util
14
15 from contrib.cros_benchmarks import cros_utils
16
17
18 class CrosTabSwitchingMeasurement(legacy_page_test.LegacyPageTest):
19 def __init__(self):
20 super(CrosTabSwitchingMeasurement, self).__init__()
21 self._first_histogram = None
22
23 def CustomizeBrowserOptions(self, options):
24 """Adding necessary browser flag to collect histogram."""
25 options.AppendExtraBrowserArgs(['--enable-stats-collection-bindings'])
26
27 def DidNavigateToPage(self, page, tab):
28 """Record the starting histogram."""
29 self._first_histogram = cros_utils.GetTabSwitchHistogramRetry(tab.browser)
30
31 def ValidateAndMeasurePage(self, page, tab, results):
32 """Record the ending histogram for the tab switching metric."""
33 last_histogram = cros_utils.GetTabSwitchHistogramRetry(tab.browser)
34 total_diff_histogram = histogram_util.SubtractHistogram(last_histogram,
deanliao_goog 2017/05/23 08:54:26 Wrapping indentation: either aligned, e.g. SomeFu
35 self._first_histogram)
36
37 display_name = 'MPArch_RWH_TabSwitchPaintDuration'
38 results.AddSummaryValue(
39 histogram.HistogramValue(None, display_name, 'ms',
40 raw_value_json=total_diff_histogram,
41 important=False))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698