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

Side by Side Diff: tools/perf/measurements/tab_switching.py

Issue 474493002: [Telemetry] Shortcut 30s energy measurement if not supported. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """The tab switching measurement. 5 """The tab switching measurement.
6 6
7 This measurement opens pages in different tabs. After all the tabs have opened, 7 This measurement opens pages in different tabs. After all the tabs have opened,
8 it cycles through each tab in sequence, and records a histogram of the time 8 it cycles through each tab in sequence, and records a histogram of the time
9 between when a tab was first requested to be shown, and when it was painted. 9 between when a tab was first requested to be shown, and when it was painted.
10 Power usage is also measured. 10 Power usage is also measured.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 def ValidateAndMeasurePage(self, page, tab, results): 56 def ValidateAndMeasurePage(self, page, tab, results):
57 """On the last tab, cycle through each tab that was opened and then record 57 """On the last tab, cycle through each tab that was opened and then record
58 a single histogram for the tab switching metric.""" 58 a single histogram for the tab switching metric."""
59 if len(tab.browser.tabs) != len(page.page_set.pages): 59 if len(tab.browser.tabs) != len(page.page_set.pages):
60 return 60 return
61 61
62 # Measure power usage of tabs after quiescence. 62 # Measure power usage of tabs after quiescence.
63 util.WaitFor(tab.HasReachedQuiescence, 60) 63 util.WaitFor(tab.HasReachedQuiescence, 60)
64 64
65 self._power_metric.Start(page, tab) 65 if tab.browser.platform.CanMonitorPower():
66 time.sleep(TabSwitching.SAMPLE_TIME) 66 self._power_metric.Start(page, tab)
67 self._power_metric.Stop(page, tab) 67 time.sleep(TabSwitching.SAMPLE_TIME)
68 self._power_metric.AddResults(tab, results,) 68 self._power_metric.Stop(page, tab)
69 self._power_metric.AddResults(tab, results,)
69 70
70 histogram_name = 'MPArch.RWH_TabSwitchPaintDuration' 71 histogram_name = 'MPArch.RWH_TabSwitchPaintDuration'
71 histogram_type = histogram_util.BROWSER_HISTOGRAM 72 histogram_type = histogram_util.BROWSER_HISTOGRAM
72 display_name = 'MPArch_RWH_TabSwitchPaintDuration' 73 display_name = 'MPArch_RWH_TabSwitchPaintDuration'
73 first_histogram = histogram_util.GetHistogram( 74 first_histogram = histogram_util.GetHistogram(
74 histogram_type, histogram_name, tab) 75 histogram_type, histogram_name, tab)
75 prev_histogram = first_histogram 76 prev_histogram = first_histogram
76 77
77 for i in xrange(len(tab.browser.tabs)): 78 for i in xrange(len(tab.browser.tabs)):
78 t = tab.browser.tabs[i] 79 t = tab.browser.tabs[i]
(...skipping 10 matching lines...) Expand all
89 90
90 last_histogram = histogram_util.GetHistogram( 91 last_histogram = histogram_util.GetHistogram(
91 histogram_type, histogram_name, tab) 92 histogram_type, histogram_name, tab)
92 diff_histogram = histogram_util.SubtractHistogram(last_histogram, 93 diff_histogram = histogram_util.SubtractHistogram(last_histogram,
93 first_histogram) 94 first_histogram)
94 95
95 results.AddSummaryValue( 96 results.AddSummaryValue(
96 histogram.HistogramValue(None, display_name, '', 97 histogram.HistogramValue(None, display_name, '',
97 raw_value_json=diff_histogram, 98 raw_value_json=diff_histogram,
98 important=False)) 99 important=False))
OLDNEW
« 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