Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 os | 5 import os |
| 6 from telemetry import benchmark | 6 from telemetry import benchmark |
| 7 from core import perf_benchmark | 7 from core import perf_benchmark |
| 8 from core import path_util | 8 from core import path_util |
| 9 from telemetry.timeline import tracing_category_filter | 9 from telemetry.timeline import tracing_category_filter |
| 10 from telemetry.web_perf import timeline_based_measurement | 10 from telemetry.web_perf import timeline_based_measurement |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 'Release', 'mr_extension', 'release'), | 32 'Release', 'mr_extension', 'release'), |
| 33 os.path.join(path_util.GetChromiumSrcDir(), 'out', | 33 os.path.join(path_util.GetChromiumSrcDir(), 'out', |
| 34 'Release', 'media_router', 'test_extension')]), | 34 'Release', 'media_router', 'test_extension')]), |
| 35 '--whitelisted-extension-id=enhhojjnijigcajfphajepfemndkmdlo', | 35 '--whitelisted-extension-id=enhhojjnijigcajfphajepfemndkmdlo', |
| 36 '--media-router=1', | 36 '--media-router=1', |
| 37 '--enable-stats-collection-bindings' | 37 '--enable-stats-collection-bindings' |
| 38 ]) | 38 ]) |
| 39 | 39 |
| 40 | 40 |
| 41 class TraceEventCastBenckmark(_BaseCastBenchmark): | 41 class TraceEventCastBenckmark(_BaseCastBenchmark): |
| 42 """Benchmark for dialog latency from trace event.""" | |
| 42 | 43 |
| 43 def CreateTimelineBasedMeasurementOptions(self): | 44 def CreateTimelineBasedMeasurementOptions(self): |
| 44 media_router_category = 'media_router' | 45 media_router_category = 'media_router' |
| 45 category_filter = tracing_category_filter.TracingCategoryFilter( | 46 category_filter = tracing_category_filter.TracingCategoryFilter( |
| 46 media_router_category) | 47 media_router_category) |
| 47 category_filter.AddIncludedCategory('blink.console') | 48 category_filter.AddIncludedCategory('blink.console') |
| 48 options = timeline_based_measurement.Options(category_filter) | 49 options = timeline_based_measurement.Options(category_filter) |
| 49 options.SetLegacyTimelineBasedMetrics([ | 50 options.SetLegacyTimelineBasedMetrics([ |
| 50 media_router_timeline_metric.MediaRouterMetric()]) | 51 media_router_timeline_metric.MediaRouterMetric()]) |
| 51 return options | 52 return options |
| 52 | 53 |
| 53 @classmethod | 54 @classmethod |
| 54 def Name(cls): | 55 def Name(cls): |
| 55 return 'media_router.dialog.latency.tracing' | 56 return 'media_router.dialog.latency.tracing' |
| 56 | 57 |
| 57 @classmethod | 58 @classmethod |
| 58 def ValueCanBeAddedPredicate(cls, value, is_first_result): | 59 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 59 """Only drops the first result.""" | 60 """Only drops the first result.""" |
| 60 return not is_first_result | 61 return not is_first_result |
| 61 | 62 |
| 62 | 63 |
| 63 class HistogramCastBenckmark(_BaseCastBenchmark): | 64 class HistogramCastBenckmark(_BaseCastBenchmark): |
| 65 """Benchmark for dialog latency from histograms.""" | |
| 64 | 66 |
| 65 def CreatePageTest(self, options): | 67 def CreatePageTest(self, options): |
| 66 return media_router_measurements.MediaRouterDialogTest() | 68 return media_router_measurements.MediaRouterDialogTest() |
| 67 | 69 |
| 68 @classmethod | 70 @classmethod |
| 69 def Name(cls): | 71 def Name(cls): |
| 70 return 'media_router.dialog.latency.histogram' | 72 return 'media_router.dialog.latency.histogram' |
| 71 | 73 |
| 72 @classmethod | 74 @classmethod |
| 73 def ValueCanBeAddedPredicate(cls, value, is_first_result): | 75 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 74 """Only drops the first result.""" | 76 """Only drops the first result.""" |
| 75 return not is_first_result | 77 return not is_first_result |
| 76 | 78 |
| 77 | 79 |
| 78 class CPUMemoryCastBenckmark(_BaseCastBenchmark): | 80 class CPUMemoryCastBenckmark(_BaseCastBenchmark): |
| 81 """Benchmark for CPU and memory usage with Media Router.""" | |
| 82 | |
| 79 options = {'page_repeat': 1} | 83 options = {'page_repeat': 1} |
| 80 | 84 |
| 81 page_set = media_router_perf_pages.MediaRouterCPUMemoryPageSet | 85 page_set = media_router_perf_pages.MediaRouterCPUMemoryPageSet |
| 82 | 86 |
| 83 def CreatePageTest(self, options): | 87 def CreatePageTest(self, options): |
| 84 return media_router_measurements.MediaRouterCPUMemoryTest() | 88 return media_router_measurements.MediaRouterCPUMemoryTest() |
| 85 | 89 |
| 86 @classmethod | 90 @classmethod |
| 87 def Name(cls): | 91 def Name(cls): |
| 88 return 'media_router.cpu_memory' | 92 return 'media_router.cpu_memory' |
| 93 | |
| 94 | |
| 95 class CPUMemoryBenckmark(perf_benchmark.PerfBenchmark): | |
| 96 """Benchmark for CPU and memory usage without Media Router.""" | |
| 97 | |
| 98 options = {'page_repeat': 1} | |
| 99 | |
| 100 page_set = media_router_perf_pages.CPUMemoryPageSet | |
| 101 | |
| 102 def SetExtraBrowserOptions(self, options): | |
| 103 options.clear_sytem_cache_for_browser_and_profile_on_start = True | |
| 104 # This flag is required to enable the communication between the page and | |
| 105 # the test extension. | |
| 106 options.disable_background_networking = False | |
| 107 options.AppendExtraBrowserArgs([ | |
| 108 '--load-extension=' + | |
|
imcheng
2016/05/12 20:57:08
1) we don't need to load the extension if MR is di
Lei Lei
2016/05/12 21:07:14
1), it doesn't load MR extension, it only loads th
| |
| 109 os.path.join(path_util.GetChromiumSrcDir(), 'out', | |
| 110 'Release', 'media_router', 'test_extension'), | |
| 111 '--enable-stats-collection-bindings' | |
| 112 ]) | |
| 113 | |
| 114 def CreatePageTest(self, options): | |
| 115 return media_router_measurements.MediaRouterCPUMemoryTest() | |
| 116 | |
| 117 @classmethod | |
| 118 def Name(cls): | |
| 119 return 'media_router.cpu_memory.no_media_router' | |
| OLD | NEW |