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

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

Issue 23523005: Make recording basic media metrics optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Access page-set property at the start of gathering metrics, to identify whether or not to skip logg… Created 7 years, 3 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 | « no previous file | tools/perf/metrics/media.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 import os
6 import sys
7
5 from metrics import media 8 from metrics import media
6 from telemetry.page import page_measurement 9 from telemetry.page import page_measurement
10 from telemetry.page import page_set
11
7 12
8 class Media(page_measurement.PageMeasurement): 13 class Media(page_measurement.PageMeasurement):
9 """The MediaMeasurement class gathers media-related metrics on a page set. 14 """The MediaMeasurement class gathers media-related metrics on a page set.
10 15
11 Media metrics recorded are controlled by metrics/media.js. At the end of the 16 Media metrics recorded are controlled by metrics/media.js. At the end of the
12 test each metric for every media element in the page are reported. 17 test each metric for every media element in the page are reported.
13 """ 18 """
14 def __init__(self): 19 def __init__(self):
15 super(Media, self).__init__('media_metrics') 20 super(Media, self).__init__('media_metrics')
16 self._media_metric = None 21 self._media_metric = None
17 22
23 def CreatePageSet(self, args, options):
dtu 2013/08/30 19:38:34 Are you still using this? Remove?
anandc 2013/08/30 20:18:51 Thanks for the catch. Removed.
24 if len(args) < 2:
25 print 'Must specify a file or directory to run.'
26 sys.exit(1)
27
28 page_set_arg = args[1]
29
30 if not os.path.exists(page_set_arg):
31 print '%s does not exist.' % page_set_arg
32 sys.exit(1)
33
34 return page_set.PageSet.FromFile(page_set_arg)
35
18 def results_are_the_same_on_every_page(self): 36 def results_are_the_same_on_every_page(self):
19 """Results can vary from page to page based on media events taking place.""" 37 """Results can vary from page to page based on media events taking place."""
20 return False 38 return False
21 39
22 def DidNavigateToPage(self, page, tab): 40 def DidNavigateToPage(self, page, tab):
23 """Override to do operations right after the page is navigated.""" 41 """Override to do operations right after the page is navigated."""
24 self._media_metric = media.MediaMetric(tab) 42 self._media_metric = media.MediaMetric(tab)
25 self._media_metric.Start(page, tab) 43 self._media_metric.Start(page, tab)
26 44
27 def MeasurePage(self, page, tab, results): 45 def MeasurePage(self, page, tab, results):
28 """Measure the page's performance.""" 46 """Measure the page's performance."""
29 self._media_metric.Stop(page, tab) 47 self._media_metric.Stop(page, tab)
30 self._media_metric.AddResults(tab, results) 48 self._media_metric.AddResults(tab, results)
49
OLDNEW
« no previous file with comments | « no previous file | tools/perf/metrics/media.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698