OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 if self._report_speed_index: | 158 if self._report_speed_index: |
159 def SpeedIndexIsFinished(): | 159 def SpeedIndexIsFinished(): |
160 return self._speedindex_metric.IsFinished(tab) | 160 return self._speedindex_metric.IsFinished(tab) |
161 util.WaitFor(SpeedIndexIsFinished, 60) | 161 util.WaitFor(SpeedIndexIsFinished, 60) |
162 self._speedindex_metric.Stop(page, tab) | 162 self._speedindex_metric.Stop(page, tab) |
163 self._speedindex_metric.AddResults( | 163 self._speedindex_metric.AddResults( |
164 tab, results, chart_name=chart_name_prefix+'speed_index') | 164 tab, results, chart_name=chart_name_prefix+'speed_index') |
165 | 165 |
166 def DidRunTest(self, browser, results): | 166 def DidRunTest(self, browser, results): |
167 self._memory_metric.AddSummaryResults(results) | |
168 io.IOMetric().AddSummaryResults(browser, results) | 167 io.IOMetric().AddSummaryResults(browser, results) |
169 | 168 |
170 def IsRunCold(self, url): | 169 def IsRunCold(self, url): |
171 return (self.ShouldRunCold(url) or | 170 return (self.ShouldRunCold(url) or |
172 self._has_loaded_page[url] == 0) | 171 self._has_loaded_page[url] == 0) |
173 | 172 |
174 def ShouldRunCold(self, url): | 173 def ShouldRunCold(self, url): |
175 # We do the warm runs first for two reasons. The first is so we can | 174 # We do the warm runs first for two reasons. The first is so we can |
176 # preserve any initial profile cache for as long as possible. | 175 # preserve any initial profile cache for as long as possible. |
177 # The second is that, if we did cold runs first, we'd have a transition | 176 # The second is that, if we did cold runs first, we'd have a transition |
178 # page set during which we wanted the run for each URL to both | 177 # page set during which we wanted the run for each URL to both |
179 # contribute to the cold data and warm the catch for the following | 178 # contribute to the cold data and warm the catch for the following |
180 # warm run, and clearing the cache before the load of the following | 179 # warm run, and clearing the cache before the load of the following |
181 # URL would eliminate the intended warmup for the previous URL. | 180 # URL would eliminate the intended warmup for the previous URL. |
182 return (self._has_loaded_page[url] >= self._cold_run_start_index) | 181 return (self._has_loaded_page[url] >= self._cold_run_start_index) |
183 | 182 |
184 def results_are_the_same_on_every_page(self): | 183 def results_are_the_same_on_every_page(self): |
185 return False | 184 return False |
OLD | NEW |