| 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 telemetry.internal.util import camel_case |    9 from telemetry.internal.util import camel_case | 
|   10 from telemetry.value import list_of_scalar_values |   10 from telemetry.value import list_of_scalar_values | 
|   11  |   11  | 
|   12 from metrics import Metric |   12 from metrics import Metric | 
|   13  |   13  | 
|   14  |   14  | 
|   15 INTERESTING_METRICS = { |   15 INTERESTING_METRICS = { | 
|   16     'packetsReceived': { |  | 
|   17         'units': 'packets', |  | 
|   18         'description': 'Packets received by the peer connection', |  | 
|   19     }, |  | 
|   20     'packetsSent': { |  | 
|   21         'units': 'packets', |  | 
|   22         'description': 'Packets sent by the peer connection', |  | 
|   23     }, |  | 
|   24     'googDecodeMs': { |   16     'googDecodeMs': { | 
|   25         'units': 'ms', |   17         'units': 'ms', | 
|   26         'description': 'Time spent decoding.', |   18         'description': 'Time spent decoding.', | 
|   27     }, |   19     }, | 
|   28     'googMaxDecodeMs': { |   20     'googMaxDecodeMs': { | 
|   29         'units': 'ms', |   21         'units': 'ms', | 
|   30         'description': 'Maximum time spent decoding one frame.', |   22         'description': 'Maximum time spent decoding one frame.', | 
|   31     }, |   23     }, | 
 |   24     'googAvgEncodeMs': { | 
 |   25         'units': 'ms', | 
 |   26         'description': 'Average time spent encoding one frame.' | 
 |   27     }, | 
|   32     'googRtt': { |   28     'googRtt': { | 
|   33         'units': 'ms', |   29         'units': 'ms', | 
|   34         'description': 'Measured round-trip time.', |   30         'description': 'Measured round-trip time.', | 
|   35     }, |   31     }, | 
|   36     'googJitterReceived': { |   32     'googJitterReceived': { | 
|   37         'units': 'ms', |   33         'units': 'ms', | 
|   38         'description': 'Receive-side jitter in milliseconds.', |   34         'description': 'Receive-side jitter in milliseconds.', | 
|   39     }, |   35     }, | 
|   40     'googCaptureJitterMs': { |   36     'googCaptureJitterMs': { | 
|   41         'units': 'ms', |   37         'units': 'ms', | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
|   64     }, |   60     }, | 
|   65     'googAvailableReceiveBandwidth': { |   61     'googAvailableReceiveBandwidth': { | 
|   66         'units': 'bit/s', |   62         'units': 'bit/s', | 
|   67         'description': 'How much receive bandwidth we estimate we have.' |   63         'description': 'How much receive bandwidth we estimate we have.' | 
|   68     }, |   64     }, | 
|   69     'googTargetEncBitrate': { |   65     'googTargetEncBitrate': { | 
|   70         'units': 'bit/s', |   66         'units': 'bit/s', | 
|   71         'description': ('The target encoding bitrate we estimate is good to ' |   67         'description': ('The target encoding bitrate we estimate is good to ' | 
|   72                         'aim for given our bandwidth estimates.') |   68                         'aim for given our bandwidth estimates.') | 
|   73     }, |   69     }, | 
|   74     'googTransmitBitrate': { |  | 
|   75         'units': 'bit/s', |  | 
|   76         'description': 'The actual transmit bitrate.' |  | 
|   77     }, |  | 
|   78 } |   70 } | 
|   79  |   71  | 
|   80  |   72  | 
|   81 def GetReportKind(report): |   73 def GetReportKind(report): | 
|   82   if 'audioInputLevel' in report or 'audioOutputLevel' in report: |   74   if 'audioInputLevel' in report or 'audioOutputLevel' in report: | 
|   83     return 'audio' |   75     return 'audio' | 
|   84   if 'googFrameRateSent' in report or 'googFrameRateReceived' in report: |   76   if 'googFrameRateSent' in report or 'googFrameRateReceived' in report: | 
|   85     return 'video' |   77     return 'video' | 
|   86   if 'googAvailableSendBandwidth' in report: |   78   if 'googAvailableSendBandwidth' in report: | 
|   87     return 'bwe' |   79     return 'bwe' | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  142  |  134  | 
|  143       for stat_name, values in time_series.iteritems(): |  135       for stat_name, values in time_series.iteritems(): | 
|  144         stat_name_underscored = camel_case.ToUnderscore(stat_name) |  136         stat_name_underscored = camel_case.ToUnderscore(stat_name) | 
|  145         trace_name = 'peer_connection_%d_%s' % (i, stat_name_underscored) |  137         trace_name = 'peer_connection_%d_%s' % (i, stat_name_underscored) | 
|  146         general_name = StripAudioVideoBweDistinction(stat_name) |  138         general_name = StripAudioVideoBweDistinction(stat_name) | 
|  147         results.AddValue(list_of_scalar_values.ListOfScalarValues( |  139         results.AddValue(list_of_scalar_values.ListOfScalarValues( | 
|  148             results.current_page, trace_name, |  140             results.current_page, trace_name, | 
|  149             INTERESTING_METRICS[general_name]['units'], values, |  141             INTERESTING_METRICS[general_name]['units'], values, | 
|  150             description=INTERESTING_METRICS[general_name]['description'], |  142             description=INTERESTING_METRICS[general_name]['description'], | 
|  151             important=False)) |  143             important=False)) | 
| OLD | NEW |