Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: tools/perf/measurements/page_cycler.py

Issue 962793004: [Telemetry] Make "discard_first_result" apply to user_stories too. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/benchmarks/startup.py ('k') | tools/perf/measurements/startup.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 raise Exception('cold-load-percent must be in the range [0-100]') 54 raise Exception('cold-load-percent must be in the range [0-100]')
55 55
56 # Make sure _cold_run_start_index is an integer multiple of page_repeat. 56 # Make sure _cold_run_start_index is an integer multiple of page_repeat.
57 # Without this, --pageset_shuffle + --page_repeat could lead to 57 # Without this, --pageset_shuffle + --page_repeat could lead to
58 # assertion failures on _started_warm in WillNavigateToPage. 58 # assertion failures on _started_warm in WillNavigateToPage.
59 if cold_runs_percent_set: 59 if cold_runs_percent_set:
60 number_warm_pageset_runs = int( 60 number_warm_pageset_runs = int(
61 (int(pageset_repeat) - 1) * (100 - cold_load_percent) / 100) 61 (int(pageset_repeat) - 1) * (100 - cold_load_percent) / 100)
62 number_warm_runs = number_warm_pageset_runs * page_repeat 62 number_warm_runs = number_warm_pageset_runs * page_repeat
63 self._cold_run_start_index = number_warm_runs + page_repeat 63 self._cold_run_start_index = number_warm_runs + page_repeat
64 self._discard_first_result = (not cold_load_percent or
65 self._discard_first_result)
66 else: 64 else:
67 self._cold_run_start_index = pageset_repeat * page_repeat 65 self._cold_run_start_index = pageset_repeat * page_repeat
68 66
69 def WillStartBrowser(self, platform): 67 def WillStartBrowser(self, platform):
70 """Initialize metrics once right before the browser has been launched.""" 68 """Initialize metrics once right before the browser has been launched."""
71 self._power_metric = power.PowerMetric(platform) 69 self._power_metric = power.PowerMetric(platform)
72 70
73 def DidStartBrowser(self, browser): 71 def DidStartBrowser(self, browser):
74 """Initialize metrics once right after the browser has been launched.""" 72 """Initialize metrics once right after the browser has been launched."""
75 self._memory_metric = memory.MemoryMetric(browser) 73 self._memory_metric = memory.MemoryMetric(browser)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 144
147 def ShouldRunCold(self, url): 145 def ShouldRunCold(self, url):
148 # We do the warm runs first for two reasons. The first is so we can 146 # We do the warm runs first for two reasons. The first is so we can
149 # preserve any initial profile cache for as long as possible. 147 # preserve any initial profile cache for as long as possible.
150 # The second is that, if we did cold runs first, we'd have a transition 148 # The second is that, if we did cold runs first, we'd have a transition
151 # page set during which we wanted the run for each URL to both 149 # page set during which we wanted the run for each URL to both
152 # contribute to the cold data and warm the catch for the following 150 # contribute to the cold data and warm the catch for the following
153 # warm run, and clearing the cache before the load of the following 151 # warm run, and clearing the cache before the load of the following
154 # URL would eliminate the intended warmup for the previous URL. 152 # URL would eliminate the intended warmup for the previous URL.
155 return (self._has_loaded_page[url] >= self._cold_run_start_index) 153 return (self._has_loaded_page[url] >= self._cold_run_start_index)
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/startup.py ('k') | tools/perf/measurements/startup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698