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