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) |
167 io.IOMetric().AddSummaryResults(browser, results) | 168 io.IOMetric().AddSummaryResults(browser, results) |
168 | 169 |
169 def IsRunCold(self, url): | 170 def IsRunCold(self, url): |
170 return (self.ShouldRunCold(url) or | 171 return (self.ShouldRunCold(url) or |
171 self._has_loaded_page[url] == 0) | 172 self._has_loaded_page[url] == 0) |
172 | 173 |
173 def ShouldRunCold(self, url): | 174 def ShouldRunCold(self, url): |
174 # We do the warm runs first for two reasons. The first is so we can | 175 # We do the warm runs first for two reasons. The first is so we can |
175 # preserve any initial profile cache for as long as possible. | 176 # preserve any initial profile cache for as long as possible. |
176 # The second is that, if we did cold runs first, we'd have a transition | 177 # The second is that, if we did cold runs first, we'd have a transition |
177 # page set during which we wanted the run for each URL to both | 178 # page set during which we wanted the run for each URL to both |
178 # contribute to the cold data and warm the catch for the following | 179 # contribute to the cold data and warm the catch for the following |
179 # warm run, and clearing the cache before the load of the following | 180 # warm run, and clearing the cache before the load of the following |
180 # URL would eliminate the intended warmup for the previous URL. | 181 # URL would eliminate the intended warmup for the previous URL. |
181 return (self._has_loaded_page[url] >= self._cold_run_start_index) | 182 return (self._has_loaded_page[url] >= self._cold_run_start_index) |
182 | 183 |
183 def results_are_the_same_on_every_page(self): | 184 def results_are_the_same_on_every_page(self): |
184 return False | 185 return False |
OLD | NEW |