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

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

Issue 809393002: Added support for improvement_direction to relevant values, which is propogated to chartjson. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linter issues Created 5 years, 11 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 2012 The Chromium Authors. All rights reserved. 1 # Copyright 2012 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 page cycler measurement. 5 """The page cycler measurement.
6 6
7 This measurement registers a window load handler in which is forces a layout and 7 This measurement registers a window load handler in which is forces a layout and
8 then records the value of performance.now(). This call to now() measures the 8 then records the value of performance.now(). This call to now() measures the
9 time from navigationStart (immediately after the previous page's beforeunload 9 time from navigationStart (immediately after the previous page's beforeunload
10 event) until after the layout in the page's load event. In addition, two garbage 10 event) until after the layout in the page's load event. In addition, two garbage
11 collections are performed in between the page loads (in the beforeunload event). 11 collections are performed in between the page loads (in the beforeunload event).
12 This extra garbage collection time is not included in the measurement times. 12 This extra garbage collection time is not included in the measurement times.
13 13
14 Finally, various memory and IO statistics are gathered at the very end of 14 Finally, various memory and IO statistics are gathered at the very end of
15 cycling all pages. 15 cycling all pages.
16 """ 16 """
17 17
18 import collections 18 import collections
19 import os 19 import os
20 20
21 from metrics import cpu 21 from metrics import cpu
22 from metrics import memory 22 from metrics import memory
23 from metrics import power 23 from metrics import power
24 from metrics import speedindex 24 from metrics import speedindex
25 from metrics import v8_object_stats 25 from metrics import v8_object_stats
26 from telemetry.core import util 26 from telemetry.core import util
27 from telemetry.page import page_test 27 from telemetry.page import page_test
28 from telemetry.value import improvement_direction
28 from telemetry.value import scalar 29 from telemetry.value import scalar
29 30
30 31
31 class PageCycler(page_test.PageTest): 32 class PageCycler(page_test.PageTest):
32 def __init__(self, page_repeat, pageset_repeat, cold_load_percent=50, 33 def __init__(self, page_repeat, pageset_repeat, cold_load_percent=50,
33 record_v8_object_stats=False, report_speed_index=False, 34 record_v8_object_stats=False, report_speed_index=False,
34 clear_cache_before_each_run=False): 35 clear_cache_before_each_run=False):
35 super(PageCycler, self).__init__( 36 super(PageCycler, self).__init__(
36 clear_cache_before_each_run=clear_cache_before_each_run) 37 clear_cache_before_each_run=clear_cache_before_each_run)
37 38
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 'warm_') 119 'warm_')
119 120
120 results.AddValue(scalar.ScalarValue( 121 results.AddValue(scalar.ScalarValue(
121 results.current_page, '%stimes.page_load_time' % chart_name_prefix, 122 results.current_page, '%stimes.page_load_time' % chart_name_prefix,
122 'ms', tab.EvaluateJavaScript('__pc_load_time'), 123 'ms', tab.EvaluateJavaScript('__pc_load_time'),
123 description='Average page load time. Measured from ' 124 description='Average page load time. Measured from '
124 'performance.timing.navigationStart until the completion ' 125 'performance.timing.navigationStart until the completion '
125 'time of a layout after the window.load event. Cold times ' 126 'time of a layout after the window.load event. Cold times '
126 'are the times when the page is loaded cold, i.e. without ' 127 'are the times when the page is loaded cold, i.e. without '
127 'loading it before, and warm times are times when the ' 128 'loading it before, and warm times are times when the '
128 'page is loaded after being loaded previously.')) 129 'page is loaded after being loaded previously.',
130 improvement_direction=improvement_direction.DOWN))
129 131
130 self._has_loaded_page[page.url] += 1 132 self._has_loaded_page[page.url] += 1
131 133
132 self._power_metric.Stop(page, tab) 134 self._power_metric.Stop(page, tab)
133 self._memory_metric.Stop(page, tab) 135 self._memory_metric.Stop(page, tab)
134 self._memory_metric.AddResults(tab, results) 136 self._memory_metric.AddResults(tab, results)
135 self._power_metric.AddResults(tab, results) 137 self._power_metric.AddResults(tab, results)
136 138
137 self._cpu_metric.Stop(page, tab) 139 self._cpu_metric.Stop(page, tab)
138 self._cpu_metric.AddResults(tab, results) 140 self._cpu_metric.AddResults(tab, results)
(...skipping 15 matching lines...) Expand all
154 156
155 def ShouldRunCold(self, url): 157 def ShouldRunCold(self, url):
156 # We do the warm runs first for two reasons. The first is so we can 158 # We do the warm runs first for two reasons. The first is so we can
157 # preserve any initial profile cache for as long as possible. 159 # preserve any initial profile cache for as long as possible.
158 # The second is that, if we did cold runs first, we'd have a transition 160 # The second is that, if we did cold runs first, we'd have a transition
159 # page set during which we wanted the run for each URL to both 161 # page set during which we wanted the run for each URL to both
160 # contribute to the cold data and warm the catch for the following 162 # contribute to the cold data and warm the catch for the following
161 # warm run, and clearing the cache before the load of the following 163 # warm run, and clearing the cache before the load of the following
162 # URL would eliminate the intended warmup for the previous URL. 164 # URL would eliminate the intended warmup for the previous URL.
163 return (self._has_loaded_page[url] >= self._cold_run_start_index) 165 return (self._has_loaded_page[url] >= self._cold_run_start_index)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698