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

Side by Side Diff: tools/perf/perf_tools/startup_measurement.py

Issue 12389073: Collect tab timing information for use in telementry-based startup tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix telemetry tests with reference builds. Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 import json 5 import json
6 6
7 from telemetry.page import page_measurement 7 from telemetry.page import page_measurement
8 8
9 # Test how long Chrome takes to load when warm. 9 # Test how long Chrome takes to load when warm.
10 class PerfWarm(page_measurement.PageMeasurement): 10 class PerfWarm(page_measurement.PageMeasurement):
11 HISTOGRAMS_TO_RECORD = { 11 HISTOGRAMS_TO_RECORD = {
12 'messageloop_start_time' : 12 'messageloop_start_time' :
13 'Startup.BrowserMessageLoopStartTimeFromMainEntry', 13 'Startup.BrowserMessageLoopStartTimeFromMainEntry',
14 'window_display_time' : 'Startup.BrowserWindowDisplay', 14 'window_display_time' : 'Startup.BrowserWindowDisplay',
15 'open_tabs_time' : 'Startup.BrowserOpenTabs'} 15 'open_tabs_time' : 'Startup.BrowserOpenTabs'}
16 16
17 def __init__(self): 17 def __init__(self):
18 super(PerfWarm, self).__init__(needs_browser_restart_after_each_run=True, 18 super(PerfWarm, self).__init__(needs_browser_restart_after_each_run=True,
19 discard_first_result=True) 19 discard_first_result=True)
20 20
21 def CustomizeBrowserOptions(self, options): 21 def CustomizeBrowserOptions(self, options):
22 options.AppendExtraBrowserArg('--enable-stats-collection-bindings')
23 options.AppendExtraBrowserArg(
24 '--reduce-security-for-stats-collection-tests')
25
26 # Old commandline flags used for reference builds.
22 options.AppendExtraBrowserArg('--dom-automation') 27 options.AppendExtraBrowserArg('--dom-automation')
23 options.AppendExtraBrowserArg('--reduce-security-for-dom-automation-tests') 28 options.AppendExtraBrowserArg(
29 '--reduce-security-for-dom-automation-tests')
24 30
25 def MeasurePage(self, page, tab, results): 31 def MeasurePage(self, page, tab, results):
26 get_histogram_js = "domAutomationController.getBrowserHistogram(\"%s\")" 32 # TODO(jeremy): Remove references to
33 # domAutomationController.getBrowserHistogram when we update the reference
34 # builds.
35 get_histogram_js = ('(window.statsCollectionController ?'
36 'statsCollectionController :'
37 'domAutomationController).getBrowserHistogram("%s")')
38
27 39
28 for display_name, histogram_name in self.HISTOGRAMS_TO_RECORD.iteritems(): 40 for display_name, histogram_name in self.HISTOGRAMS_TO_RECORD.iteritems():
29 result = tab.EvaluateJavaScript(get_histogram_js % histogram_name) 41 result = tab.EvaluateJavaScript(get_histogram_js % histogram_name)
30 result = json.loads(result) 42 result = json.loads(result)
31 measured_time = 0 43 measured_time = 0
32 44
33 if 'sum' in result: 45 if 'sum' in result:
34 # For all the histograms logged here, there's a single entry so sum 46 # For all the histograms logged here, there's a single entry so sum
35 # is the exact value for that entry. 47 # is the exact value for that entry.
36 measured_time = result['sum'] 48 measured_time = result['sum']
37 elif 'buckets' in result: 49 elif 'buckets' in result:
38 measured_time = \ 50 measured_time = \
39 (result['buckets'][0]['high'] + result['buckets'][0]['low']) / 2 51 (result['buckets'][0]['high'] + result['buckets'][0]['low']) / 2
40 52
41 results.Add(display_name, 'ms', measured_time) 53 results.Add(display_name, 'ms', measured_time)
OLDNEW
« tools/perf/perf_tools/histogram_metric.py ('K') | « tools/perf/perf_tools/page_cycler.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698