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

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

Issue 329723004: Change results.Add to results.AddResult in endure, media metrics and media benchmark. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Tony's comments Created 6 years, 6 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 | « tools/perf/measurements/endure.py ('k') | no next file » | 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 import logging 4 import logging
5 import os 5 import os
6 6
7 from metrics import Metric 7 from metrics import Metric
8 from telemetry.value import list_of_scalar_values
9 from telemetry.value import scalar
8 10
9 11
10 class MediaMetric(Metric): 12 class MediaMetric(Metric):
11 """MediaMetric class injects and calls JS responsible for recording metrics. 13 """MediaMetric class injects and calls JS responsible for recording metrics.
12 14
13 Default media metrics are collected for every media element in the page, 15 Default media metrics are collected for every media element in the page,
14 such as decoded_frame_count, dropped_frame_count, decoded_video_bytes, and 16 such as decoded_frame_count, dropped_frame_count, decoded_video_bytes, and
15 decoded_audio_bytes. 17 decoded_audio_bytes.
16 """ 18 """
17 19
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 'decoded_bytes': 13233, 53 'decoded_bytes': 13233,
52 ... 54 ...
53 } 55 }
54 } 56 }
55 """ 57 """
56 def AddOneResult(metric, unit): 58 def AddOneResult(metric, unit):
57 metrics = media_metric['metrics'] 59 metrics = media_metric['metrics']
58 for m in metrics: 60 for m in metrics:
59 if m.startswith(metric): 61 if m.startswith(metric):
60 special_label = m[len(metric):] 62 special_label = m[len(metric):]
63 trace_name = '%s.%s%s' % (metric, trace, special_label)
61 if isinstance(metrics[m], list): 64 if isinstance(metrics[m], list):
62 values = [float(v) for v in metrics[m]] 65 results.AddValue(list_of_scalar_values.ListOfScalarValues(
66 results.current_page, trace_name, unit,
67 values=[float(v) for v in metrics[m]],
68 important=True))
63 else: 69 else:
64 values = float(metrics[m]) 70 results.AddValue(scalar.ScalarValue(
65 results.Add(trace + special_label, unit, values, 71 results.current_page, trace_name, unit, value=float(metrics[m]),
66 chart_name=metric, data_type='default') 72 important=True))
67 73
68 trace = media_metric['id'] 74 trace = media_metric['id']
69 if not trace: 75 if not trace:
70 logging.error('Metrics ID is missing in results.') 76 logging.error('Metrics ID is missing in results.')
71 return 77 return
72 78
73 if not self._skip_basic_metrics: 79 if not self._skip_basic_metrics:
74 AddOneResult('buffering_time', 'ms') 80 AddOneResult('buffering_time', 'ms')
75 AddOneResult('decoded_audio_bytes', 'bytes') 81 AddOneResult('decoded_audio_bytes', 'bytes')
76 AddOneResult('decoded_video_bytes', 'bytes') 82 AddOneResult('decoded_video_bytes', 'bytes')
77 AddOneResult('decoded_frame_count', 'frames') 83 AddOneResult('decoded_frame_count', 'frames')
78 AddOneResult('dropped_frame_count', 'frames') 84 AddOneResult('dropped_frame_count', 'frames')
79 AddOneResult('time_to_play', 'ms') 85 AddOneResult('time_to_play', 'ms')
80 86
81 AddOneResult('avg_loop_time', 'ms') 87 AddOneResult('avg_loop_time', 'ms')
82 AddOneResult('seek', 'ms') 88 AddOneResult('seek', 'ms')
83 return trace 89 return trace
OLDNEW
« no previous file with comments | « tools/perf/measurements/endure.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698