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

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

Issue 350763005: [Telemetry] Power metric: subtract quiescent power draw from result (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit tests 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
« no previous file with comments | « tools/perf/measurements/tab_switching.py ('k') | tools/perf/metrics/power.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 from metrics import cpu 5 from metrics import cpu
6 from metrics import memory 6 from metrics import memory
7 from metrics import power 7 from metrics import power
8 from telemetry.page import page_measurement 8 from telemetry.page import page_measurement
9 9
10 10
11 class WebRTC(page_measurement.PageMeasurement): 11 class WebRTC(page_measurement.PageMeasurement):
12 """Gathers WebRTC-related metrics on a page set.""" 12 """Gathers WebRTC-related metrics on a page set."""
13 13
14 def __init__(self): 14 def __init__(self):
15 super(WebRTC, self).__init__('RunWebrtc') 15 super(WebRTC, self).__init__('RunWebrtc')
16 self._cpu_metric = None 16 self._cpu_metric = None
17 self._memory_metric = None 17 self._memory_metric = None
18 self._power_metric = power.PowerMetric() 18 self._power_metric = None
19
20 def WillStartBrowser(self, browser):
21 self._power_metric = power.PowerMetric(browser)
19 22
20 def DidStartBrowser(self, browser): 23 def DidStartBrowser(self, browser):
21 self._cpu_metric = cpu.CpuMetric(browser) 24 self._cpu_metric = cpu.CpuMetric(browser)
22 self._memory_metric = memory.MemoryMetric(browser) 25 self._memory_metric = memory.MemoryMetric(browser)
23 26
24 def DidNavigateToPage(self, page, tab): 27 def DidNavigateToPage(self, page, tab):
25 self._cpu_metric.Start(page, tab) 28 self._cpu_metric.Start(page, tab)
26 self._memory_metric.Start(page, tab) 29 self._memory_metric.Start(page, tab)
27 self._power_metric.Start(page, tab) 30 self._power_metric.Start(page, tab)
28 31
29 def CustomizeBrowserOptions(self, options): 32 def CustomizeBrowserOptions(self, options):
30 memory.MemoryMetric.CustomizeBrowserOptions(options) 33 memory.MemoryMetric.CustomizeBrowserOptions(options)
31 options.AppendExtraBrowserArgs('--use-fake-device-for-media-stream') 34 options.AppendExtraBrowserArgs('--use-fake-device-for-media-stream')
32 options.AppendExtraBrowserArgs('--use-fake-ui-for-media-stream') 35 options.AppendExtraBrowserArgs('--use-fake-ui-for-media-stream')
33 power.PowerMetric.CustomizeBrowserOptions(options) 36 power.PowerMetric.CustomizeBrowserOptions(options)
34 37
35 def MeasurePage(self, page, tab, results): 38 def MeasurePage(self, page, tab, results):
36 """Measure the page's performance.""" 39 """Measure the page's performance."""
37 self._memory_metric.Stop(page, tab) 40 self._memory_metric.Stop(page, tab)
38 self._memory_metric.AddResults(tab, results) 41 self._memory_metric.AddResults(tab, results)
39 42
40 self._cpu_metric.Stop(page, tab) 43 self._cpu_metric.Stop(page, tab)
41 self._cpu_metric.AddResults(tab, results) 44 self._cpu_metric.AddResults(tab, results)
42 45
43 self._power_metric.Stop(page, tab) 46 self._power_metric.Stop(page, tab)
44 self._power_metric.AddResults(tab, results) 47 self._power_metric.AddResults(tab, results)
OLDNEW
« no previous file with comments | « tools/perf/measurements/tab_switching.py ('k') | tools/perf/metrics/power.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698