| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 # page cyclers which use the filesystem. | 75 # page cyclers which use the filesystem. |
| 76 tab.Navigate(tab.browser.http_server.UrlOf('nonexistent.html')) | 76 tab.Navigate(tab.browser.http_server.UrlOf('nonexistent.html')) |
| 77 | 77 |
| 78 def WillNavigateToPage(self, page, tab): | 78 def WillNavigateToPage(self, page, tab): |
| 79 page.script_to_evaluate_on_commit = self._page_cycler_js | 79 page.script_to_evaluate_on_commit = self._page_cycler_js |
| 80 if self.ShouldRunCold(page.url): | 80 if self.ShouldRunCold(page.url): |
| 81 tab.ClearCache(force=True) | 81 tab.ClearCache(force=True) |
| 82 if self._report_speed_index: | 82 if self._report_speed_index: |
| 83 self._speedindex_metric.Start(page, tab) | 83 self._speedindex_metric.Start(page, tab) |
| 84 self._cpu_metric.Start(page, tab) | 84 self._cpu_metric.Start(page, tab) |
| 85 self._power_metric.Start(page, tab) |
| 85 | 86 |
| 86 def DidNavigateToPage(self, page, tab): | 87 def DidNavigateToPage(self, page, tab): |
| 87 self._memory_metric.Start(page, tab) | 88 self._memory_metric.Start(page, tab) |
| 88 self._power_metric.Start(page, tab) | |
| 89 if self._record_v8_object_stats: | 89 if self._record_v8_object_stats: |
| 90 self._v8_object_stats_metric.Start(page, tab) | 90 self._v8_object_stats_metric.Start(page, tab) |
| 91 | 91 |
| 92 def CustomizeBrowserOptions(self, options): | 92 def CustomizeBrowserOptions(self, options): |
| 93 memory.MemoryMetric.CustomizeBrowserOptions(options) | 93 memory.MemoryMetric.CustomizeBrowserOptions(options) |
| 94 power.PowerMetric.CustomizeBrowserOptions(options) | 94 power.PowerMetric.CustomizeBrowserOptions(options) |
| 95 iometric.IOMetric.CustomizeBrowserOptions(options) | 95 iometric.IOMetric.CustomizeBrowserOptions(options) |
| 96 options.AppendExtraBrowserArgs('--js-flags=--expose_gc') | 96 options.AppendExtraBrowserArgs('--js-flags=--expose_gc') |
| 97 | 97 |
| 98 if self._record_v8_object_stats: | 98 if self._record_v8_object_stats: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 # preserve any initial profile cache for as long as possible. | 164 # preserve any initial profile cache for as long as possible. |
| 165 # The second is that, if we did cold runs first, we'd have a transition | 165 # The second is that, if we did cold runs first, we'd have a transition |
| 166 # page set during which we wanted the run for each URL to both | 166 # page set during which we wanted the run for each URL to both |
| 167 # contribute to the cold data and warm the catch for the following | 167 # contribute to the cold data and warm the catch for the following |
| 168 # warm run, and clearing the cache before the load of the following | 168 # warm run, and clearing the cache before the load of the following |
| 169 # URL would eliminate the intended warmup for the previous URL. | 169 # URL would eliminate the intended warmup for the previous URL. |
| 170 return (self._has_loaded_page[url] >= self._cold_run_start_index) | 170 return (self._has_loaded_page[url] >= self._cold_run_start_index) |
| 171 | 171 |
| 172 def results_are_the_same_on_every_page(self): | 172 def results_are_the_same_on_every_page(self): |
| 173 return False | 173 return False |
| OLD | NEW |