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

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

Issue 350763005: [Telemetry] Power metric: subtract quiescent power draw from result (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 5 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 | Annotate | Revision Log
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 21 matching lines...) Expand all
32 32
33 def __init__(self, *args, **kwargs): 33 def __init__(self, *args, **kwargs):
34 super(PageCycler, self).__init__(*args, **kwargs) 34 super(PageCycler, self).__init__(*args, **kwargs)
35 35
36 with open(os.path.join(os.path.dirname(__file__), 36 with open(os.path.join(os.path.dirname(__file__),
37 'page_cycler.js'), 'r') as f: 37 'page_cycler.js'), 'r') as f:
38 self._page_cycler_js = f.read() 38 self._page_cycler_js = f.read()
39 39
40 self._speedindex_metric = speedindex.SpeedIndexMetric() 40 self._speedindex_metric = speedindex.SpeedIndexMetric()
41 self._memory_metric = None 41 self._memory_metric = None
42 self._power_metric = power.PowerMetric() 42 self._power_metric = None
43 self._cpu_metric = None 43 self._cpu_metric = None
44 self._v8_object_stats_metric = None 44 self._v8_object_stats_metric = None
45 self._has_loaded_page = collections.defaultdict(int) 45 self._has_loaded_page = collections.defaultdict(int)
46 46
47 @classmethod 47 @classmethod
48 def AddCommandLineArgs(cls, parser): 48 def AddCommandLineArgs(cls, parser):
49 parser.add_option('--v8-object-stats', 49 parser.add_option('--v8-object-stats',
50 action='store_true', 50 action='store_true',
51 help='Enable detailed V8 object statistics.') 51 help='Enable detailed V8 object statistics.')
52 52
(...skipping 21 matching lines...) Expand all
74 if cold_runs_percent_set: 74 if cold_runs_percent_set:
75 number_warm_pageset_runs = int( 75 number_warm_pageset_runs = int(
76 (int(args.pageset_repeat) - 1) * (100 - args.cold_load_percent) / 100) 76 (int(args.pageset_repeat) - 1) * (100 - args.cold_load_percent) / 100)
77 number_warm_runs = number_warm_pageset_runs * args.page_repeat 77 number_warm_runs = number_warm_pageset_runs * args.page_repeat
78 cls._cold_run_start_index = number_warm_runs + args.page_repeat 78 cls._cold_run_start_index = number_warm_runs + args.page_repeat
79 cls.discard_first_result = (not args.cold_load_percent or 79 cls.discard_first_result = (not args.cold_load_percent or
80 cls.discard_first_result) 80 cls.discard_first_result)
81 else: 81 else:
82 cls._cold_run_start_index = args.pageset_repeat * args.page_repeat 82 cls._cold_run_start_index = args.pageset_repeat * args.page_repeat
83 83
84 def WillStartBrowser(self, browser):
85 """Initialize metrics once right before the browser has been launched."""
qsr 2014/07/01 09:02:24 Nit: Why is there a comment on 2 of them, and not
86 self._power_metric = power.PowerMetric(browser)
87
84 def DidStartBrowser(self, browser): 88 def DidStartBrowser(self, browser):
85 """Initialize metrics once right after the browser has been launched.""" 89 """Initialize metrics once right after the browser has been launched."""
86 self._memory_metric = memory.MemoryMetric(browser) 90 self._memory_metric = memory.MemoryMetric(browser)
87 self._cpu_metric = cpu.CpuMetric(browser) 91 self._cpu_metric = cpu.CpuMetric(browser)
88 if self._record_v8_object_stats: 92 if self._record_v8_object_stats:
89 self._v8_object_stats_metric = v8_object_stats.V8ObjectStatsMetric() 93 self._v8_object_stats_metric = v8_object_stats.V8ObjectStatsMetric()
90 94
91 def DidStartHTTPServer(self, tab): 95 def DidStartHTTPServer(self, tab):
92 # Avoid paying for a cross-renderer navigation on the first page on legacy 96 # Avoid paying for a cross-renderer navigation on the first page on legacy
93 # page cyclers which use the filesystem. 97 # page cyclers which use the filesystem.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 # preserve any initial profile cache for as long as possible. 165 # preserve any initial profile cache for as long as possible.
162 # The second is that, if we did cold runs first, we'd have a transition 166 # The second is that, if we did cold runs first, we'd have a transition
163 # page set during which we wanted the run for each URL to both 167 # page set during which we wanted the run for each URL to both
164 # contribute to the cold data and warm the catch for the following 168 # contribute to the cold data and warm the catch for the following
165 # warm run, and clearing the cache before the load of the following 169 # warm run, and clearing the cache before the load of the following
166 # URL would eliminate the intended warmup for the previous URL. 170 # URL would eliminate the intended warmup for the previous URL.
167 return (self._has_loaded_page[url] >= self._cold_run_start_index) 171 return (self._has_loaded_page[url] >= self._cold_run_start_index)
168 172
169 def results_are_the_same_on_every_page(self): 173 def results_are_the_same_on_every_page(self):
170 return False 174 return False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698