| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if cold_runs_percent_set: | 76 if cold_runs_percent_set: |
| 77 number_warm_pageset_runs = int( | 77 number_warm_pageset_runs = int( |
| 78 (int(args.pageset_repeat) - 1) * (100 - args.cold_load_percent) / 100) | 78 (int(args.pageset_repeat) - 1) * (100 - args.cold_load_percent) / 100) |
| 79 number_warm_runs = number_warm_pageset_runs * args.page_repeat | 79 number_warm_runs = number_warm_pageset_runs * args.page_repeat |
| 80 cls._cold_run_start_index = number_warm_runs + args.page_repeat | 80 cls._cold_run_start_index = number_warm_runs + args.page_repeat |
| 81 cls.discard_first_result = (not args.cold_load_percent or | 81 cls.discard_first_result = (not args.cold_load_percent or |
| 82 cls.discard_first_result) | 82 cls.discard_first_result) |
| 83 else: | 83 else: |
| 84 cls._cold_run_start_index = args.pageset_repeat * args.page_repeat | 84 cls._cold_run_start_index = args.pageset_repeat * args.page_repeat |
| 85 | 85 |
| 86 def WillStartBrowser(self, browser): | 86 def WillStartBrowser(self, platform): |
| 87 """Initialize metrics once right before the browser has been launched.""" | 87 """Initialize metrics once right before the browser has been launched.""" |
| 88 self._power_metric = power.PowerMetric(browser) | 88 self._power_metric = power.PowerMetric(platform) |
| 89 | 89 |
| 90 def DidStartBrowser(self, browser): | 90 def DidStartBrowser(self, browser): |
| 91 """Initialize metrics once right after the browser has been launched.""" | 91 """Initialize metrics once right after the browser has been launched.""" |
| 92 self._memory_metric = memory.MemoryMetric(browser) | 92 self._memory_metric = memory.MemoryMetric(browser) |
| 93 self._cpu_metric = cpu.CpuMetric(browser) | 93 self._cpu_metric = cpu.CpuMetric(browser) |
| 94 if self._record_v8_object_stats: | 94 if self._record_v8_object_stats: |
| 95 self._v8_object_stats_metric = v8_object_stats.V8ObjectStatsMetric() | 95 self._v8_object_stats_metric = v8_object_stats.V8ObjectStatsMetric() |
| 96 | 96 |
| 97 def DidStartHTTPServer(self, tab): | 97 def DidStartHTTPServer(self, tab): |
| 98 # Avoid paying for a cross-renderer navigation on the first page on legacy | 98 # Avoid paying for a cross-renderer navigation on the first page on legacy |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 def ShouldRunCold(self, url): | 171 def ShouldRunCold(self, url): |
| 172 # We do the warm runs first for two reasons. The first is so we can | 172 # We do the warm runs first for two reasons. The first is so we can |
| 173 # preserve any initial profile cache for as long as possible. | 173 # preserve any initial profile cache for as long as possible. |
| 174 # The second is that, if we did cold runs first, we'd have a transition | 174 # The second is that, if we did cold runs first, we'd have a transition |
| 175 # page set during which we wanted the run for each URL to both | 175 # page set during which we wanted the run for each URL to both |
| 176 # contribute to the cold data and warm the catch for the following | 176 # contribute to the cold data and warm the catch for the following |
| 177 # warm run, and clearing the cache before the load of the following | 177 # warm run, and clearing the cache before the load of the following |
| 178 # URL would eliminate the intended warmup for the previous URL. | 178 # URL would eliminate the intended warmup for the previous URL. |
| 179 return (self._has_loaded_page[url] >= self._cold_run_start_index) | 179 return (self._has_loaded_page[url] >= self._cold_run_start_index) |
| OLD | NEW |