OLD | NEW |
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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 from metrics import power | 24 from metrics import power |
25 from metrics import speedindex | 25 from metrics import speedindex |
26 from metrics import v8_object_stats | 26 from metrics import v8_object_stats |
27 from telemetry.core import util | 27 from telemetry.core import util |
28 from telemetry.page import page_test | 28 from telemetry.page import page_test |
29 from telemetry.value import scalar | 29 from telemetry.value import scalar |
30 | 30 |
31 | 31 |
32 class PageCycler(page_test.PageTest): | 32 class PageCycler(page_test.PageTest): |
33 def __init__(self, page_repeat, pageset_repeat, cold_load_percent=50, | 33 def __init__(self, page_repeat, pageset_repeat, cold_load_percent=50, |
34 record_v8_object_stats=False, report_speed_index=False): | 34 record_v8_object_stats=False, report_speed_index=False, |
35 super(PageCycler, self).__init__() | 35 clear_cache_before_each_run=False): |
| 36 super(PageCycler, self).__init__( |
| 37 clear_cache_before_each_run=clear_cache_before_each_run) |
36 | 38 |
37 with open(os.path.join(os.path.dirname(__file__), | 39 with open(os.path.join(os.path.dirname(__file__), |
38 'page_cycler.js'), 'r') as f: | 40 'page_cycler.js'), 'r') as f: |
39 self._page_cycler_js = f.read() | 41 self._page_cycler_js = f.read() |
40 | 42 |
41 self._record_v8_object_stats = record_v8_object_stats | 43 self._record_v8_object_stats = record_v8_object_stats |
42 self._report_speed_index = report_speed_index | 44 self._report_speed_index = report_speed_index |
43 self._speedindex_metric = speedindex.SpeedIndexMetric() | 45 self._speedindex_metric = speedindex.SpeedIndexMetric() |
44 self._memory_metric = None | 46 self._memory_metric = None |
45 self._power_metric = None | 47 self._power_metric = None |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 159 |
158 def ShouldRunCold(self, url): | 160 def ShouldRunCold(self, url): |
159 # We do the warm runs first for two reasons. The first is so we can | 161 # We do the warm runs first for two reasons. The first is so we can |
160 # preserve any initial profile cache for as long as possible. | 162 # preserve any initial profile cache for as long as possible. |
161 # The second is that, if we did cold runs first, we'd have a transition | 163 # The second is that, if we did cold runs first, we'd have a transition |
162 # page set during which we wanted the run for each URL to both | 164 # page set during which we wanted the run for each URL to both |
163 # contribute to the cold data and warm the catch for the following | 165 # contribute to the cold data and warm the catch for the following |
164 # warm run, and clearing the cache before the load of the following | 166 # warm run, and clearing the cache before the load of the following |
165 # URL would eliminate the intended warmup for the previous URL. | 167 # URL would eliminate the intended warmup for the previous URL. |
166 return (self._has_loaded_page[url] >= self._cold_run_start_index) | 168 return (self._has_loaded_page[url] >= self._cold_run_start_index) |
OLD | NEW |