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

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

Issue 105753006: Revert "Revert 239784 "Make page_cycler.py fully measure memory for each..."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Shadi's comment Created 7 years 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 | « build/android/pylib/android_commands.py ('k') | tools/perf/measurements/memory.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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 media 6 from metrics import media
7 from metrics import memory 7 from metrics import memory
8 from telemetry.page import page_measurement 8 from telemetry.page import page_measurement
9 9
10 10
11 class Media(page_measurement.PageMeasurement): 11 class Media(page_measurement.PageMeasurement):
12 """The MediaMeasurement class gathers media-related metrics on a page set. 12 """The MediaMeasurement class gathers media-related metrics on a page set.
13 13
14 Media metrics recorded are controlled by metrics/media.js. At the end of the 14 Media metrics recorded are controlled by metrics/media.js. At the end of the
15 test each metric for every media element in the page are reported. 15 test each metric for every media element in the page are reported.
16 """ 16 """
17 17
18 def __init__(self): 18 def __init__(self):
19 super(Media, self).__init__('media_metrics') 19 super(Media, self).__init__('media_metrics')
20 self._media_metric = None 20 self._media_metric = None
21 # Used to add browser memory and CPU metrics to results per test. 21 # Used to add browser memory and CPU metrics to results per test.
22 self._add_browser_metrics = False 22 self._add_browser_metrics = False
23 self._cpu_metric = None 23 self._cpu_metric = None
24 self._memory_metric = None 24 self._memory_metric = None
25 25
26 def results_are_the_same_on_every_page(self): 26 def results_are_the_same_on_every_page(self):
27 """Results can vary from page to page based on media events taking place.""" 27 """Results can vary from page to page based on media events taking place."""
28 return False 28 return False
29 29
30 def CustomizeBrowserOptions(self, options):
31 memory.MemoryMetric.CustomizeBrowserOptions(options)
32
30 def DidNavigateToPage(self, page, tab): 33 def DidNavigateToPage(self, page, tab):
31 """Override to do operations right after the page is navigated.""" 34 """Override to do operations right after the page is navigated."""
32 self._media_metric = media.MediaMetric(tab) 35 self._media_metric = media.MediaMetric(tab)
33 self._media_metric.Start(page, tab) 36 self._media_metric.Start(page, tab)
34 # Reset to false for every page. 37 # Reset to false for every page.
35 self._add_browser_metrics = False 38 self._add_browser_metrics = False
36 if hasattr(page, 'add_browser_metrics'): 39 if hasattr(page, 'add_browser_metrics'):
37 self._add_browser_metrics = page.add_browser_metrics 40 self._add_browser_metrics = page.add_browser_metrics
38 41
39 # Start browser metrics at page level to isolate startup CPU usage. 42 # Start browser metrics at page level to isolate startup CPU usage.
40 if self._add_browser_metrics: 43 if self._add_browser_metrics:
41 self._cpu_metric = cpu.CpuMetric(tab.browser) 44 self._cpu_metric = cpu.CpuMetric(tab.browser)
42 self._cpu_metric.Start(page, tab) 45 self._cpu_metric.Start(page, tab)
43 # No need to start memory metric since we are only interested in Summary
44 # results.
45 self._memory_metric = memory.MemoryMetric(tab.browser) 46 self._memory_metric = memory.MemoryMetric(tab.browser)
47 self._memory_metric.Start(page, tab)
46 48
47 def MeasurePage(self, page, tab, results): 49 def MeasurePage(self, page, tab, results):
48 """Measure the page's performance.""" 50 """Measure the page's performance."""
49 self._media_metric.Stop(page, tab) 51 self._media_metric.Stop(page, tab)
50 trace_name = self._media_metric.AddResults(tab, results) 52 trace_name = self._media_metric.AddResults(tab, results)
51 if self._add_browser_metrics: 53 if self._add_browser_metrics:
52 self._cpu_metric.Stop(page, tab) 54 self._cpu_metric.Stop(page, tab)
53 self._cpu_metric.AddResults(tab, results, trace_name=trace_name) 55 self._cpu_metric.AddResults(tab, results, trace_name=trace_name)
54 self._memory_metric.AddSummaryResults(results, trace_name=trace_name) 56 self._memory_metric.Stop(page, tab)
57 self._memory_metric.AddResults(tab, results, trace_name=trace_name)
OLDNEW
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | tools/perf/measurements/memory.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698