OLD | NEW |
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 | 8 |
9 | 9 |
10 class MediaMetric(Metric): | 10 class MediaMetric(Metric): |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 'decoded_bytes': 13233, | 49 'decoded_bytes': 13233, |
50 ... | 50 ... |
51 } | 51 } |
52 } | 52 } |
53 """ | 53 """ |
54 def AddOneResult(metric, unit): | 54 def AddOneResult(metric, unit): |
55 metrics = media_metric['metrics'] | 55 metrics = media_metric['metrics'] |
56 for m in metrics: | 56 for m in metrics: |
57 if m.startswith(metric): | 57 if m.startswith(metric): |
58 special_label = m[len(metric):] | 58 special_label = m[len(metric):] |
59 results.Add(trace + special_label, unit, str(metrics[m]), | 59 results.Add(trace + special_label, unit, metrics[m], |
60 chart_name=metric, data_type='default') | 60 chart_name=metric, data_type='default') |
61 | 61 |
62 trace = media_metric['id'] | 62 trace = media_metric['id'] |
63 if not trace: | 63 if not trace: |
64 logging.error('Metrics ID is missing in results.') | 64 logging.error('Metrics ID is missing in results.') |
65 return | 65 return |
66 | 66 |
67 if not self._skip_basic_metrics: | 67 if not self._skip_basic_metrics: |
68 AddOneResult('buffering_time', 'ms') | 68 AddOneResult('buffering_time', 'ms') |
69 AddOneResult('decoded_audio_bytes', 'bytes') | 69 AddOneResult('decoded_audio_bytes', 'bytes') |
70 AddOneResult('decoded_video_bytes', 'bytes') | 70 AddOneResult('decoded_video_bytes', 'bytes') |
71 AddOneResult('decoded_frame_count', 'frames') | 71 AddOneResult('decoded_frame_count', 'frames') |
72 AddOneResult('dropped_frame_count', 'frames') | 72 AddOneResult('dropped_frame_count', 'frames') |
73 AddOneResult('time_to_play', 'ms') | 73 AddOneResult('time_to_play', 'ms') |
74 | 74 |
75 AddOneResult('avg_loop_time', 'ms') | 75 AddOneResult('avg_loop_time', 'ms') |
76 AddOneResult('seek', 'ms') | 76 AddOneResult('seek', 'ms') |
OLD | NEW |