OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 json | 5 import json |
6 import logging | 6 import logging |
7 import re | 7 import re |
8 | 8 |
9 from metrics import Metric | 9 from metrics import Metric |
10 from telemetry.core import camel_case | 10 from telemetry.core import camel_case |
| 11 from telemetry.value import improvement_direction |
11 from telemetry.value import list_of_scalar_values | 12 from telemetry.value import list_of_scalar_values |
12 | 13 |
13 INTERESTING_METRICS = { | 14 INTERESTING_METRICS = { |
14 'packetsReceived': { | 15 'packetsReceived': { |
15 'units': 'packets', | 16 'units': 'packets', |
16 'description': 'Packets received by the peer connection', | 17 'description': 'Packets received by the peer connection', |
| 18 'improvement_direction': improvement_direction.DOWN, |
17 }, | 19 }, |
18 'packetsSent': { | 20 'packetsSent': { |
19 'units': 'packets', | 21 'units': 'packets', |
20 'description': 'Packets sent by the peer connection', | 22 'description': 'Packets sent by the peer connection', |
| 23 'improvement_direction': improvement_direction.DOWN, |
21 }, | 24 }, |
22 'googDecodeMs': { | 25 'googDecodeMs': { |
23 'units': 'ms', | 26 'units': 'ms', |
24 'description': 'Time spent decoding.', | 27 'description': 'Time spent decoding.', |
| 28 'improvement_direction': improvement_direction.DOWN, |
25 }, | 29 }, |
26 'googMaxDecodeMs': { | 30 'googMaxDecodeMs': { |
27 'units': 'ms', | 31 'units': 'ms', |
28 'description': 'Maximum time spent decoding one frame.', | 32 'description': 'Maximum time spent decoding one frame.', |
| 33 'improvement_direction': improvement_direction.DOWN, |
29 }, | 34 }, |
30 # TODO(phoglund): Add much more interesting metrics. | 35 # TODO(phoglund): Add much more interesting metrics. |
31 } | 36 } |
32 | 37 |
33 | 38 |
34 def GetReportKind(report): | 39 def GetReportKind(report): |
35 if 'audioInputLevel' in report or 'audioOutputLevel' in report: | 40 if 'audioInputLevel' in report or 'audioOutputLevel' in report: |
36 return 'audio' | 41 return 'audio' |
37 if 'googFrameRateSent' in report or 'googFrameRateReceived' in report: | 42 if 'googFrameRateSent' in report or 'googFrameRateReceived' in report: |
38 return 'video' | 43 return 'video' |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 time_series = SortStatsIntoTimeSeries(report) | 96 time_series = SortStatsIntoTimeSeries(report) |
92 | 97 |
93 for stat_name, values in time_series.iteritems(): | 98 for stat_name, values in time_series.iteritems(): |
94 stat_name_underscored = camel_case.ToUnderscore(stat_name) | 99 stat_name_underscored = camel_case.ToUnderscore(stat_name) |
95 trace_name = 'peer_connection_%d_%s' % (i, stat_name_underscored) | 100 trace_name = 'peer_connection_%d_%s' % (i, stat_name_underscored) |
96 general_name = StripAudioVideoDistinction(stat_name) | 101 general_name = StripAudioVideoDistinction(stat_name) |
97 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 102 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
98 results.current_page, trace_name, | 103 results.current_page, trace_name, |
99 INTERESTING_METRICS[general_name]['units'], values, | 104 INTERESTING_METRICS[general_name]['units'], values, |
100 description=INTERESTING_METRICS[general_name]['description'], | 105 description=INTERESTING_METRICS[general_name]['description'], |
101 important=False)) | 106 important=False, |
| 107 improvement_direction=INTERESTING_METRICS[ |
| 108 general_name]['improvement_direction'])) |
OLD | NEW |