| 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 from core import perf_benchmark | 5 from core import perf_benchmark |
| 6 | 6 |
| 7 from measurements import webrtc | |
| 8 import page_sets | 7 import page_sets |
| 9 from telemetry import benchmark | 8 from telemetry import benchmark |
| 10 from telemetry.timeline import chrome_trace_category_filter | 9 from telemetry.timeline import chrome_trace_category_filter |
| 11 from telemetry.web_perf import timeline_based_measurement | 10 from telemetry.web_perf import timeline_based_measurement |
| 12 from telemetry.web_perf.metrics import webrtc_rendering_timeline | |
| 13 | |
| 14 RENDERING_VALUE_PREFIX = 'WebRTCRendering_' | |
| 15 | |
| 16 # TODO(qyearsley, mcasas): Add webrtc.audio when http://crbug.com/468732 | |
| 17 # is fixed, or revert https://codereview.chromium.org/1544573002/ when | |
| 18 # http://crbug.com/568333 is fixed. | |
| 19 | 11 |
| 20 | 12 |
| 21 class _Webrtc(perf_benchmark.PerfBenchmark): | 13 @benchmark.Owner(emails=['qiangchen@chromium.org', # For smoothness metrics |
| 14 'ehmaldonado@chromium.org', |
| 15 'phoglund@chromium.org']) |
| 16 class WebrtcPerfBenchmark(perf_benchmark.PerfBenchmark): |
| 22 """Base class for WebRTC metrics for real-time communications tests.""" | 17 """Base class for WebRTC metrics for real-time communications tests.""" |
| 23 test = webrtc.WebRTC | 18 page_set = page_sets.WebrtcPageSet |
| 24 | |
| 25 | |
| 26 class WebrtcGetusermedia(_Webrtc): | |
| 27 """Measures WebRtc GetUserMedia for video capture and local playback.""" | |
| 28 page_set = page_sets.WebrtcGetusermediaPageSet | |
| 29 | 19 |
| 30 @classmethod | 20 @classmethod |
| 31 def Name(cls): | 21 def Name(cls): |
| 32 return 'webrtc.getusermedia' | 22 return 'webrtc' |
| 33 | |
| 34 | |
| 35 class WebrtcPeerConnection(_Webrtc): | |
| 36 """Measures WebRtc Peerconnection for remote video and audio communication.""" | |
| 37 page_set = page_sets.WebrtcPeerconnectionPageSet | |
| 38 | |
| 39 @classmethod | |
| 40 def Name(cls): | |
| 41 return 'webrtc.peerconnection' | |
| 42 | |
| 43 | |
| 44 @benchmark.Owner(emails=['phoglund@chromium.org']) | |
| 45 class WebrtcDataChannel(_Webrtc): | |
| 46 """Measures WebRtc DataChannel loopback.""" | |
| 47 page_set = page_sets.WebrtcDatachannelPageSet | |
| 48 | |
| 49 @classmethod | |
| 50 def Name(cls): | |
| 51 return 'webrtc.datachannel' | |
| 52 | |
| 53 | |
| 54 @benchmark.Disabled('win') | |
| 55 @benchmark.Owner(emails=['ehmaldonado@chromium.org', 'phoglund@chromium.org']) | |
| 56 class WebrtcStressTest(perf_benchmark.PerfBenchmark): | |
| 57 """Measures WebRtc CPU and GPU usage with multiple peer connections.""" | |
| 58 page_set = page_sets.WebrtcStresstestPageSet | |
| 59 | |
| 60 @classmethod | |
| 61 def Name(cls): | |
| 62 return 'webrtc.stress' | |
| 63 | |
| 64 def CreatePageTest(self, options): | |
| 65 # Exclude all stats. | |
| 66 return webrtc.WebRTC(particular_metrics=['googAvgEncodeMs', | |
| 67 'googFrameRateReceived']) | |
| 68 | |
| 69 | |
| 70 # WebrtcRendering must be a PerfBenchmark, and not a _Webrtc, because it is a | |
| 71 # timeline-based. | |
| 72 # Disabled on reference builds because they crash and don't support tab | |
| 73 # capture. See http://crbug.com/603232. | |
| 74 @benchmark.Disabled('reference') | |
| 75 @benchmark.Disabled('android') # http://crbug.com/610019 | |
| 76 @benchmark.Owner(emails=['qiangchen@chromium.org']) | |
| 77 class WebrtcRendering(perf_benchmark.PerfBenchmark): | |
| 78 """Specific time measurements (e.g. fps, smoothness) for WebRtc rendering.""" | |
| 79 | |
| 80 page_set = page_sets.WebrtcRenderingPageSet | |
| 81 | 23 |
| 82 def CreateTimelineBasedMeasurementOptions(self): | 24 def CreateTimelineBasedMeasurementOptions(self): |
| 25 categories = [ |
| 26 # Disable all categories by default. |
| 27 '-*', |
| 28 'toplevel', |
| 29 # WebRTC |
| 30 'webrtc', |
| 31 ] |
| 32 |
| 83 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter( | 33 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter( |
| 84 filter_string='webrtc,webkit.console,blink.console') | 34 filter_string=','.join(categories)) |
| 85 options = timeline_based_measurement.Options(category_filter) | |
| 86 options.SetLegacyTimelineBasedMetrics( | |
| 87 [webrtc_rendering_timeline.WebRtcRenderingTimelineMetric()]) | |
| 88 return options | |
| 89 | |
| 90 def SetExtraBrowserOptions(self, options): | |
| 91 options.AppendExtraBrowserArgs('--use-fake-device-for-media-stream') | |
| 92 options.AppendExtraBrowserArgs('--use-fake-ui-for-media-stream') | |
| 93 | |
| 94 @classmethod | |
| 95 def Name(cls): | |
| 96 return 'webrtc.webrtc_smoothness' | |
| 97 | |
| 98 | |
| 99 # WebrtcRenderingTBMv2 must be a PerfBenchmark, and not a _Webrtc, because it is | |
| 100 # a timeline-based metric. | |
| 101 @benchmark.Owner(emails=['ehmaldonado@chromium.org', | |
| 102 'phoglund@chromium.org', | |
| 103 'qiangchen@chromium.org']) | |
| 104 class WebrtcRenderingTBMv2(perf_benchmark.PerfBenchmark): | |
| 105 """Specific time measurements (e.g. fps, smoothness) for WebRtc rendering.""" | |
| 106 | |
| 107 page_set = page_sets.WebrtcRenderingPageSet | |
| 108 | |
| 109 def CreateTimelineBasedMeasurementOptions(self): | |
| 110 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter( | |
| 111 filter_string='webrtc,toplevel') | |
| 112 options = timeline_based_measurement.Options(category_filter) | 35 options = timeline_based_measurement.Options(category_filter) |
| 113 options.SetTimelineBasedMetrics([ | 36 options.SetTimelineBasedMetrics([ |
| 114 'cpuTimeMetric', | 37 'cpuTimeMetric', |
| 115 'expectedQueueingTimeMetric', | |
| 116 'webrtcRenderingMetric', | 38 'webrtcRenderingMetric', |
| 117 ]) | 39 ]) |
| 118 return options | 40 return options |
| 119 | 41 |
| 120 def SetExtraBrowserOptions(self, options): | 42 def SetExtraBrowserOptions(self, options): |
| 121 options.AppendExtraBrowserArgs('--use-fake-device-for-media-stream') | 43 options.AppendExtraBrowserArgs('--use-fake-device-for-media-stream') |
| 122 options.AppendExtraBrowserArgs('--use-fake-ui-for-media-stream') | 44 options.AppendExtraBrowserArgs('--use-fake-ui-for-media-stream') |
| 123 | |
| 124 @classmethod | |
| 125 def Name(cls): | |
| 126 return 'webrtc.webrtc_smoothness_tbmv2' | |
| OLD | NEW |