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

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

Issue 737403002: Revert of telemetry: Remove command line args from page test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/v8.py ('k') | tools/perf/measurements/page_cycler_unittest.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 12 matching lines...) Expand all
23 from metrics import memory 23 from metrics import memory
24 from metrics import power 24 from metrics import power
25 from metrics import speedindex 25 from metrics import speedindex
26 from metrics import v8_object_stats 26 from metrics import v8_object_stats
27 from telemetry.core import util 27 from telemetry.core import util
28 from telemetry.page import page_test 28 from telemetry.page import page_test
29 from telemetry.value import scalar 29 from telemetry.value import scalar
30 30
31 31
32 class PageCycler(page_test.PageTest): 32 class PageCycler(page_test.PageTest):
33 def __init__(self, page_repeat, pageset_repeat, cold_load_percent=50, 33 options = {'pageset_repeat': 10}
34 record_v8_object_stats=False, report_speed_index=False): 34
35 super(PageCycler, self).__init__() 35 def __init__(self, *args, **kwargs):
36 super(PageCycler, self).__init__(*args, **kwargs)
36 37
37 with open(os.path.join(os.path.dirname(__file__), 38 with open(os.path.join(os.path.dirname(__file__),
38 'page_cycler.js'), 'r') as f: 39 'page_cycler.js'), 'r') as f:
39 self._page_cycler_js = f.read() 40 self._page_cycler_js = f.read()
40 41
41 self._record_v8_object_stats = record_v8_object_stats
42 self._report_speed_index = report_speed_index
43 self._speedindex_metric = speedindex.SpeedIndexMetric() 42 self._speedindex_metric = speedindex.SpeedIndexMetric()
44 self._memory_metric = None 43 self._memory_metric = None
45 self._power_metric = None 44 self._power_metric = None
46 self._cpu_metric = None 45 self._cpu_metric = None
47 self._v8_object_stats_metric = None 46 self._v8_object_stats_metric = None
48 self._has_loaded_page = collections.defaultdict(int) 47 self._has_loaded_page = collections.defaultdict(int)
49 self._initial_renderer_url = None # to avoid cross-renderer navigation 48 self._initial_renderer_url = None # to avoid cross-renderer navigation
50 49
51 cold_runs_percent_set = (cold_load_percent != None) 50 @classmethod
51 def AddCommandLineArgs(cls, parser):
52 parser.add_option('--v8-object-stats',
53 action='store_true',
54 help='Enable detailed V8 object statistics.')
55
56 parser.add_option('--report-speed-index',
57 action='store_true',
58 help='Enable the speed index metric.')
59
60 parser.add_option('--cold-load-percent', type='int', default=50,
61 help='%d of page visits for which a cold load is forced')
62
63 @classmethod
64 def ProcessCommandLineArgs(cls, parser, args):
65 cls._record_v8_object_stats = args.v8_object_stats
66 cls._report_speed_index = args.report_speed_index
67
68 cold_runs_percent_set = (args.cold_load_percent != None)
52 # Handle requests for cold cache runs 69 # Handle requests for cold cache runs
53 if (cold_runs_percent_set and 70 if (cold_runs_percent_set and
54 (cold_load_percent < 0 or cold_load_percent > 100)): 71 (args.cold_load_percent < 0 or args.cold_load_percent > 100)):
55 raise Exception('cold-load-percent must be in the range [0-100]') 72 raise Exception('--cold-load-percent must be in the range [0-100]')
56 73
57 # Make sure _cold_run_start_index is an integer multiple of page_repeat. 74 # Make sure _cold_run_start_index is an integer multiple of page_repeat.
58 # Without this, --pageset_shuffle + --page_repeat could lead to 75 # Without this, --pageset_shuffle + --page_repeat could lead to
59 # assertion failures on _started_warm in WillNavigateToPage. 76 # assertion failures on _started_warm in WillNavigateToPage.
60 if cold_runs_percent_set: 77 if cold_runs_percent_set:
61 number_warm_pageset_runs = int( 78 number_warm_pageset_runs = int(
62 (int(pageset_repeat) - 1) * (100 - cold_load_percent) / 100) 79 (int(args.pageset_repeat) - 1) * (100 - args.cold_load_percent) / 100)
63 number_warm_runs = number_warm_pageset_runs * page_repeat 80 number_warm_runs = number_warm_pageset_runs * args.page_repeat
64 self._cold_run_start_index = number_warm_runs + page_repeat 81 cls._cold_run_start_index = number_warm_runs + args.page_repeat
65 self._discard_first_result = (not cold_load_percent or 82 cls.discard_first_result = (not args.cold_load_percent or
66 self._discard_first_result) 83 cls.discard_first_result)
67 else: 84 else:
68 self._cold_run_start_index = pageset_repeat * page_repeat 85 cls._cold_run_start_index = args.pageset_repeat * args.page_repeat
69 86
70 def WillStartBrowser(self, platform): 87 def WillStartBrowser(self, platform):
71 """Initialize metrics once right before the browser has been launched.""" 88 """Initialize metrics once right before the browser has been launched."""
72 self._power_metric = power.PowerMetric(platform) 89 self._power_metric = power.PowerMetric(platform)
73 90
74 def DidStartBrowser(self, browser): 91 def DidStartBrowser(self, browser):
75 """Initialize metrics once right after the browser has been launched.""" 92 """Initialize metrics once right after the browser has been launched."""
76 self._memory_metric = memory.MemoryMetric(browser) 93 self._memory_metric = memory.MemoryMetric(browser)
77 self._cpu_metric = cpu.CpuMetric(browser) 94 self._cpu_metric = cpu.CpuMetric(browser)
78 if self._record_v8_object_stats: 95 if self._record_v8_object_stats:
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 174
158 def ShouldRunCold(self, url): 175 def ShouldRunCold(self, url):
159 # We do the warm runs first for two reasons. The first is so we can 176 # We do the warm runs first for two reasons. The first is so we can
160 # preserve any initial profile cache for as long as possible. 177 # preserve any initial profile cache for as long as possible.
161 # The second is that, if we did cold runs first, we'd have a transition 178 # The second is that, if we did cold runs first, we'd have a transition
162 # page set during which we wanted the run for each URL to both 179 # page set during which we wanted the run for each URL to both
163 # contribute to the cold data and warm the catch for the following 180 # contribute to the cold data and warm the catch for the following
164 # warm run, and clearing the cache before the load of the following 181 # warm run, and clearing the cache before the load of the following
165 # URL would eliminate the intended warmup for the previous URL. 182 # URL would eliminate the intended warmup for the previous URL.
166 return (self._has_loaded_page[url] >= self._cold_run_start_index) 183 return (self._has_loaded_page[url] >= self._cold_run_start_index)
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/v8.py ('k') | tools/perf/measurements/page_cycler_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698