| Index: tools/perf/metrics/webrtc_stats.py
|
| diff --git a/tools/perf/metrics/webrtc_stats.py b/tools/perf/metrics/webrtc_stats.py
|
| index e96bfcc9d664b279d05d81c3e66ce1d3759833a3..c1995773283c007e56356d1e3586a7267981c042 100644
|
| --- a/tools/perf/metrics/webrtc_stats.py
|
| +++ b/tools/perf/metrics/webrtc_stats.py
|
| @@ -3,6 +3,8 @@
|
| # found in the LICENSE file.
|
|
|
| import json
|
| +import logging
|
| +import re
|
|
|
| from metrics import Metric
|
| from telemetry.core import camel_case
|
| @@ -28,6 +30,25 @@ INTERESTING_METRICS = {
|
| # TODO(phoglund): Add much more interesting metrics.
|
| }
|
|
|
| +
|
| +def GetReportKind(report):
|
| + if 'audioInputLevel' in report or 'audioOutputLevel' in report:
|
| + return 'audio'
|
| + if 'googFrameRateSent' in report or 'googFrameRateReceived' in report:
|
| + return 'video'
|
| +
|
| + logging.error('Did not recognize report batch: %s.', report.keys())
|
| + return 'unknown'
|
| +
|
| +
|
| +def DistinguishAudioAndVideo(report, stat_name):
|
| + return GetReportKind(report) + '_' + stat_name
|
| +
|
| +
|
| +def StripAudioVideoDistinction(stat_name):
|
| + return re.sub('^(audio|video)_', '', stat_name)
|
| +
|
| +
|
| def SortStatsIntoTimeSeries(report_batches):
|
| time_series = {}
|
| for report_batch in report_batches:
|
| @@ -35,7 +56,8 @@ def SortStatsIntoTimeSeries(report_batches):
|
| for stat_name, value in report.iteritems():
|
| if stat_name not in INTERESTING_METRICS:
|
| continue
|
| - time_series.setdefault(stat_name, []).append(float(value))
|
| + full_stat_name = DistinguishAudioAndVideo(report, stat_name)
|
| + time_series.setdefault(full_stat_name, []).append(float(value))
|
|
|
| return time_series
|
|
|
| @@ -66,8 +88,9 @@ class WebRtcStatisticsMetric(Metric):
|
| for stat_name, values in time_series.iteritems():
|
| stat_name_underscored = camel_case.ToUnderscore(stat_name)
|
| trace_name = 'peer_connection_%d_%s' % (i, stat_name_underscored)
|
| + general_name = StripAudioVideoDistinction(stat_name)
|
| results.AddValue(list_of_scalar_values.ListOfScalarValues(
|
| results.current_page, trace_name,
|
| - INTERESTING_METRICS[stat_name]['units'], values,
|
| - description=INTERESTING_METRICS[stat_name]['description'],
|
| + INTERESTING_METRICS[general_name]['units'], values,
|
| + description=INTERESTING_METRICS[general_name]['description'],
|
| important=False))
|
|
|