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 |
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 telemetry.core import util | 21 from telemetry.core import util |
22 from telemetry.page import page_test | 22 from telemetry.page import legacy_page_test |
23 from telemetry.value import scalar | 23 from telemetry.value import scalar |
24 | 24 |
25 from metrics import cpu | 25 from metrics import cpu |
26 from metrics import keychain_metric | 26 from metrics import keychain_metric |
27 from metrics import memory | 27 from metrics import memory |
28 from metrics import power | 28 from metrics import power |
29 from metrics import speedindex | 29 from metrics import speedindex |
30 | 30 |
31 | 31 |
32 class PageCycler(page_test.PageTest): | 32 class PageCycler(legacy_page_test.LegacyPageTest): |
33 | 33 |
34 def __init__(self, page_repeat, pageset_repeat, cold_load_percent=50, | 34 def __init__(self, page_repeat, pageset_repeat, cold_load_percent=50, |
35 report_speed_index=False, clear_cache_before_each_run=False): | 35 report_speed_index=False, clear_cache_before_each_run=False): |
36 super(PageCycler, self).__init__( | 36 super(PageCycler, self).__init__( |
37 clear_cache_before_each_run=clear_cache_before_each_run) | 37 clear_cache_before_each_run=clear_cache_before_each_run) |
38 | 38 |
39 with open(os.path.join(os.path.dirname(__file__), | 39 with open(os.path.join(os.path.dirname(__file__), |
40 'page_cycler.js'), 'r') as f: | 40 'page_cycler.js'), 'r') as f: |
41 self._page_cycler_js = f.read() | 41 self._page_cycler_js = f.read() |
42 | 42 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 # preserve any initial profile cache for as long as possible. | 147 # preserve any initial profile cache for as long as possible. |
148 # The second is that, if we did cold runs first, we'd have a transition | 148 # The second is that, if we did cold runs first, we'd have a transition |
149 # page set during which we wanted the run for each URL to both | 149 # page set during which we wanted the run for each URL to both |
150 # contribute to the cold data and warm the catch for the following | 150 # contribute to the cold data and warm the catch for the following |
151 # warm run, and clearing the cache before the load of the following | 151 # warm run, and clearing the cache before the load of the following |
152 # URL would eliminate the intended warmup for the previous URL. | 152 # URL would eliminate the intended warmup for the previous URL. |
153 return self._has_loaded_page[url] >= self._cold_run_start_index | 153 return self._has_loaded_page[url] >= self._cold_run_start_index |
154 | 154 |
155 def DidRunPage(self, platform): | 155 def DidRunPage(self, platform): |
156 self._power_metric.Close() | 156 self._power_metric.Close() |
OLD | NEW |