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

Side by Side Diff: chrome/test/media_router/telemetry/benchmarks/media_router_benchmark.py

Issue 1975603002: Add one benchmark to get CPU and memory usage without MR. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 | chrome/test/media_router/telemetry/benchmarks/media_router_cpu_memory_metric.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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'
OLDNEW
« no previous file with comments | « no previous file | chrome/test/media_router/telemetry/benchmarks/media_router_cpu_memory_metric.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698