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