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

Side by Side Diff: tools/perf/metrics/startup_metric.py

Issue 952693003: Telemetry: Move TimeoutException from util module to exceptions module. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
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 import collections 4 import collections
5 import json 5 import json
6 import logging 6 import logging
7 7
8 from metrics import Metric 8 from metrics import Metric
9 9
10 from telemetry.core import util 10 from telemetry.core import exceptions
11 from telemetry.value import histogram_util 11 from telemetry.value import histogram_util
12 from telemetry.value import scalar 12 from telemetry.value import scalar
13 13
14 14
15 class StartupMetric(Metric): 15 class StartupMetric(Metric):
16 "A metric for browser startup time." 16 "A metric for browser startup time."
17 17
18 HISTOGRAMS_TO_RECORD = { 18 HISTOGRAMS_TO_RECORD = {
19 'messageloop_start_time' : 19 'messageloop_start_time' :
20 'Startup.BrowserMessageLoopStartTimeFromMainEntry', 20 'Startup.BrowserMessageLoopStartTimeFromMainEntry',
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 perf_timing = t.EvaluateJavaScript('window.performance.timing') 68 perf_timing = t.EvaluateJavaScript('window.performance.timing')
69 if 'requestStart' not in perf_timing: 69 if 'requestStart' not in perf_timing:
70 perf_timing['requestStart'] = 0 # Exclude from benchmark results 70 perf_timing['requestStart'] = 0 # Exclude from benchmark results
71 print 'requestStart is not supported by this browser' 71 print 'requestStart is not supported by this browser'
72 72
73 tab_load_times.append(TabLoadTime( 73 tab_load_times.append(TabLoadTime(
74 int(result['load_start_ms']), 74 int(result['load_start_ms']),
75 int(result['load_duration_ms']), 75 int(result['load_duration_ms']),
76 int(perf_timing['requestStart']))) 76 int(perf_timing['requestStart'])))
77 except util.TimeoutException: 77 except exceptions.TimeoutException:
78 # Low memory Android devices may not be able to load more than 78 # Low memory Android devices may not be able to load more than
79 # one tab at a time, so may timeout when the test attempts to 79 # one tab at a time, so may timeout when the test attempts to
80 # access a background tab. Ignore these tabs. 80 # access a background tab. Ignore these tabs.
81 logging.error("Tab timed out on JavaScript access") 81 logging.error("Tab timed out on JavaScript access")
82 82
83 # Only measure the foreground tab. We can't measure all tabs on Android 83 # Only measure the foreground tab. We can't measure all tabs on Android
84 # because on Android the data of the background tabs is loaded on demand, 84 # because on Android the data of the background tabs is loaded on demand,
85 # when the user switches to them, rather than during startup. In view of 85 # when the user switches to them, rather than during startup. In view of
86 # this, to get the same measures on all platform, we only measure the 86 # this, to get the same measures on all platform, we only measure the
87 # foreground tab on all platforms. 87 # foreground tab on all platforms.
(...skipping 29 matching lines...) Expand all
117 117
118 results.AddValue(scalar.ScalarValue( 118 results.AddValue(scalar.ScalarValue(
119 results.current_page, display_name, 'ms', measured_time)) 119 results.current_page, display_name, 'ms', measured_time))
120 120
121 # Get tab load times. 121 # Get tab load times.
122 browser_main_entry_time_ms = self._GetBrowserMainEntryTime(tab) 122 browser_main_entry_time_ms = self._GetBrowserMainEntryTime(tab)
123 if (browser_main_entry_time_ms is None): 123 if (browser_main_entry_time_ms is None):
124 print "Outdated Chrome version, browser main entry time not supported." 124 print "Outdated Chrome version, browser main entry time not supported."
125 return 125 return
126 self._RecordTabLoadTimes(tab, browser_main_entry_time_ms, results) 126 self._RecordTabLoadTimes(tab, browser_main_entry_time_ms, results)
OLDNEW
« no previous file with comments | « tools/perf/measurements/rasterize_and_record_micro.py ('k') | tools/perf/profile_creators/fast_navigation_profile_extender.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698