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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 'warm_') | 118 'warm_') |
119 | 119 |
120 results.AddValue(scalar.ScalarValue( | 120 results.AddValue(scalar.ScalarValue( |
121 results.current_page, '%stimes.page_load_time' % chart_name_prefix, | 121 results.current_page, '%stimes.page_load_time' % chart_name_prefix, |
122 'ms', tab.EvaluateJavaScript('__pc_load_time'), | 122 'ms', tab.EvaluateJavaScript('__pc_load_time'), |
123 description='Average page load time. Measured from ' | 123 description='Average page load time. Measured from ' |
124 'performance.timing.navigationStart until the completion ' | 124 'performance.timing.navigationStart until the completion ' |
125 'time of a layout after the window.load event. Cold times ' | 125 'time of a layout after the window.load event. Cold times ' |
126 'are the times when the page is loaded cold, i.e. without ' | 126 'are the times when the page is loaded cold, i.e. without ' |
127 'loading it before, and warm times are times when the ' | 127 'loading it before, and warm times are times when the ' |
128 'page is loaded after being loaded previously.')) | 128 'page is loaded after being loaded previously.', |
| 129 higher_is_better=False)) |
129 | 130 |
130 self._has_loaded_page[page.url] += 1 | 131 self._has_loaded_page[page.url] += 1 |
131 | 132 |
132 self._power_metric.Stop(page, tab) | 133 self._power_metric.Stop(page, tab) |
133 self._memory_metric.Stop(page, tab) | 134 self._memory_metric.Stop(page, tab) |
134 self._memory_metric.AddResults(tab, results) | 135 self._memory_metric.AddResults(tab, results) |
135 self._power_metric.AddResults(tab, results) | 136 self._power_metric.AddResults(tab, results) |
136 | 137 |
137 self._cpu_metric.Stop(page, tab) | 138 self._cpu_metric.Stop(page, tab) |
138 self._cpu_metric.AddResults(tab, results) | 139 self._cpu_metric.AddResults(tab, results) |
(...skipping 15 matching lines...) Expand all Loading... |
154 | 155 |
155 def ShouldRunCold(self, url): | 156 def ShouldRunCold(self, url): |
156 # We do the warm runs first for two reasons. The first is so we can | 157 # 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. | 158 # 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 | 159 # 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 | 160 # 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 | 161 # 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 | 162 # warm run, and clearing the cache before the load of the following |
162 # URL would eliminate the intended warmup for the previous URL. | 163 # URL would eliminate the intended warmup for the previous URL. |
163 return (self._has_loaded_page[url] >= self._cold_run_start_index) | 164 return (self._has_loaded_page[url] >= self._cold_run_start_index) |
OLD | NEW |