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

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

Issue 44883004: [telemetry] Move tab from RunState to PageState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment nit. Created 7 years, 1 month 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 | « tools/perf/measurements/page_cycler.py ('k') | tools/perf/metrics/io.py » ('j') | 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 """ 10 """
(...skipping 10 matching lines...) Expand all
21 class TabSwitching(page_measurement.PageMeasurement): 21 class TabSwitching(page_measurement.PageMeasurement):
22 def __init__(self): 22 def __init__(self):
23 super(TabSwitching, self).__init__() 23 super(TabSwitching, self).__init__()
24 self._cpu_metric = None 24 self._cpu_metric = None
25 25
26 def CustomizeBrowserOptions(self, options): 26 def CustomizeBrowserOptions(self, options):
27 options.AppendExtraBrowserArgs([ 27 options.AppendExtraBrowserArgs([
28 '--enable-stats-collection-bindings' 28 '--enable-stats-collection-bindings'
29 ]) 29 ])
30 30
31 def TabForPage(self, page, tab): 31 def TabForPage(self, page, browser):
32 return tab.browser.tabs.New() 32 return browser.tabs.New()
33 33
34 def DidStartBrowser(self, browser): 34 def DidStartBrowser(self, browser):
35 self._cpu_metric = cpu.CpuMetric(browser) 35 self._cpu_metric = cpu.CpuMetric(browser)
36 36
37 def MeasurePage(self, page, tab, results): 37 def MeasurePage(self, page, tab, results):
38 """On the last tab, cycle through each tab that was opened and then record 38 """On the last tab, cycle through each tab that was opened and then record
39 a single histogram for the tab switching metric.""" 39 a single histogram for the tab switching metric."""
40 if len(tab.browser.tabs) != len(page.page_set.pages): 40 if len(tab.browser.tabs) != len(page.page_set.pages):
41 return 41 return
42 self._cpu_metric.Start(page, tab) 42 self._cpu_metric.Start(page, tab)
(...skipping 22 matching lines...) Expand all
65 prev_histogram = histogram_util.GetHistogram( 65 prev_histogram = histogram_util.GetHistogram(
66 histogram_type, histogram_name, tab) 66 histogram_type, histogram_name, tab)
67 67
68 last_histogram = histogram_util.GetHistogram( 68 last_histogram = histogram_util.GetHistogram(
69 histogram_type, histogram_name, tab) 69 histogram_type, histogram_name, tab)
70 diff_histogram = histogram_util.SubtractHistogram(last_histogram, 70 diff_histogram = histogram_util.SubtractHistogram(last_histogram,
71 first_histogram) 71 first_histogram)
72 72
73 results.AddSummary(histogram_name, '', diff_histogram, 73 results.AddSummary(histogram_name, '', diff_histogram,
74 data_type='unimportant-histogram') 74 data_type='unimportant-histogram')
OLDNEW
« no previous file with comments | « tools/perf/measurements/page_cycler.py ('k') | tools/perf/metrics/io.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698