Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: tools/perf/metrics/webrtc_stats.py

Issue 729643003: Relax an overly sensentive check in webrtc_stats.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 12 matching lines...) Expand all
23 'units': 'ms', 23 'units': 'ms',
24 'description': 'Time spent decoding.', 24 'description': 'Time spent decoding.',
25 }, 25 },
26 'googMaxDecodeMs': { 26 'googMaxDecodeMs': {
27 'units': 'ms', 27 'units': 'ms',
28 'description': 'Maximum time spent decoding one frame.', 28 'description': 'Maximum time spent decoding one frame.',
29 }, 29 },
30 # TODO(phoglund): Add much more interesting metrics. 30 # TODO(phoglund): Add much more interesting metrics.
31 } 31 }
32 32
33 33 # 'unknown' could return when BWE or Connection report reuse existing metric
phoglund_chromium 2014/11/17 12:29:32 Move this comment to above the return 'unknown' st
34 # names which are moung INTERESTING_METRICS
34 def GetReportKind(report): 35 def GetReportKind(report):
35 if 'audioInputLevel' in report or 'audioOutputLevel' in report: 36 if 'audioInputLevel' in report or 'audioOutputLevel' in report:
36 return 'audio' 37 return 'audio'
37 if 'googFrameRateSent' in report or 'googFrameRateReceived' in report: 38 if 'googFrameRateSent' in report or 'googFrameRateReceived' in report:
38 return 'video' 39 return 'video'
39 40
40 logging.error('Did not recognize report batch: %s.', report.keys()) 41 logging.error('Did not recognize report batch: %s.', report.keys())
phoglund_chromium 2014/11/17 12:29:32 Make this a debug-level statement since this will
41 return 'unknown' 42 return 'unknown'
42 43
43 44
44 def DistinguishAudioAndVideo(report, stat_name): 45 def DistinguishAudioAndVideo(report, stat_name):
45 return GetReportKind(report) + '_' + stat_name 46 return GetReportKind(report) + '_' + stat_name
46 47
47 48
48 def StripAudioVideoDistinction(stat_name): 49 def StripAudioVideoDistinction(stat_name):
49 return re.sub('^(audio|video)_', '', stat_name) 50 return re.sub('^(audio|video)_', '', stat_name)
50 51
51 52
52 def SortStatsIntoTimeSeries(report_batches): 53 def SortStatsIntoTimeSeries(report_batches):
53 time_series = {} 54 time_series = {}
54 for report_batch in report_batches: 55 for report_batch in report_batches:
55 for report in report_batch: 56 for report in report_batch:
56 for stat_name, value in report.iteritems(): 57 for stat_name, value in report.iteritems():
57 if stat_name not in INTERESTING_METRICS: 58 if stat_name not in INTERESTING_METRICS:
58 continue 59 continue
60 if GetReportKind(report) == 'unknown':
61 continue
59 full_stat_name = DistinguishAudioAndVideo(report, stat_name) 62 full_stat_name = DistinguishAudioAndVideo(report, stat_name)
60 time_series.setdefault(full_stat_name, []).append(float(value)) 63 time_series.setdefault(full_stat_name, []).append(float(value))
61 64
62 return time_series 65 return time_series
63 66
64 67
65 class WebRtcStatisticsMetric(Metric): 68 class WebRtcStatisticsMetric(Metric):
66 """Makes it possible to measure stats from peer connections.""" 69 """Makes it possible to measure stats from peer connections."""
67 70
68 def __init__(self): 71 def __init__(self):
(...skipping 18 matching lines...) Expand all
87 90
88 for stat_name, values in time_series.iteritems(): 91 for stat_name, values in time_series.iteritems():
89 stat_name_underscored = camel_case.ToUnderscore(stat_name) 92 stat_name_underscored = camel_case.ToUnderscore(stat_name)
90 trace_name = 'peer_connection_%d_%s' % (i, stat_name_underscored) 93 trace_name = 'peer_connection_%d_%s' % (i, stat_name_underscored)
91 general_name = StripAudioVideoDistinction(stat_name) 94 general_name = StripAudioVideoDistinction(stat_name)
92 results.AddValue(list_of_scalar_values.ListOfScalarValues( 95 results.AddValue(list_of_scalar_values.ListOfScalarValues(
93 results.current_page, trace_name, 96 results.current_page, trace_name,
94 INTERESTING_METRICS[general_name]['units'], values, 97 INTERESTING_METRICS[general_name]['units'], values,
95 description=INTERESTING_METRICS[general_name]['description'], 98 description=INTERESTING_METRICS[general_name]['description'],
96 important=False)) 99 important=False))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698