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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 'decoded_bytes': 13233, | 51 'decoded_bytes': 13233, |
52 ... | 52 ... |
53 } | 53 } |
54 } | 54 } |
55 """ | 55 """ |
56 def AddOneResult(metric, unit): | 56 def AddOneResult(metric, unit): |
57 metrics = media_metric['metrics'] | 57 metrics = media_metric['metrics'] |
58 for m in metrics: | 58 for m in metrics: |
59 if m.startswith(metric): | 59 if m.startswith(metric): |
60 special_label = m[len(metric):] | 60 special_label = m[len(metric):] |
61 results.Add(trace + special_label, unit, metrics[m], | 61 if isinstance(metrics[m], list): |
| 62 values = [float(v) for v in metrics[m]] |
| 63 else: |
| 64 values = float(metrics[m]) |
| 65 results.Add(trace + special_label, unit, values, |
62 chart_name=metric, data_type='default') | 66 chart_name=metric, data_type='default') |
63 | 67 |
64 trace = media_metric['id'] | 68 trace = media_metric['id'] |
65 if not trace: | 69 if not trace: |
66 logging.error('Metrics ID is missing in results.') | 70 logging.error('Metrics ID is missing in results.') |
67 return | 71 return |
68 | 72 |
69 if not self._skip_basic_metrics: | 73 if not self._skip_basic_metrics: |
70 AddOneResult('buffering_time', 'ms') | 74 AddOneResult('buffering_time', 'ms') |
71 AddOneResult('decoded_audio_bytes', 'bytes') | 75 AddOneResult('decoded_audio_bytes', 'bytes') |
72 AddOneResult('decoded_video_bytes', 'bytes') | 76 AddOneResult('decoded_video_bytes', 'bytes') |
73 AddOneResult('decoded_frame_count', 'frames') | 77 AddOneResult('decoded_frame_count', 'frames') |
74 AddOneResult('dropped_frame_count', 'frames') | 78 AddOneResult('dropped_frame_count', 'frames') |
75 AddOneResult('time_to_play', 'ms') | 79 AddOneResult('time_to_play', 'ms') |
76 | 80 |
77 AddOneResult('avg_loop_time', 'ms') | 81 AddOneResult('avg_loop_time', 'ms') |
78 AddOneResult('seek', 'ms') | 82 AddOneResult('seek', 'ms') |
79 AddOneResult('mse', 'ms') | 83 AddOneResult('mse', 'ms') |
80 return trace | 84 return trace |
OLD | NEW |