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

Side by Side Diff: tools/perf/benchmarks/memory_infra.py

Issue 2537153002: [tools/perf/] Rename benchmarks/memory_infra to benchmarks/memory (Closed)
Patch Set: Created 4 years 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 | « tools/perf/benchmarks/memory.py ('k') | 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
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import re
6
7 from core import perf_benchmark
8
9 from telemetry import benchmark
10 from telemetry.timeline import chrome_trace_category_filter
11 from telemetry.timeline import chrome_trace_config
12 from telemetry.web_perf import timeline_based_measurement
13
14 import page_sets
15
16
17 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames()
18 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value /numeric.html#L323
19 _IGNORED_STATS_RE = re.compile(
20 r'(?<!dump)(?<!process)_(std|count|max|min|sum|pct_\d{4}(_\d+)?)$')
21
22
23 class _MemoryInfra(perf_benchmark.PerfBenchmark):
24 """Base class for new-generation memory benchmarks based on memory-infra.
25
26 This benchmark records data using memory-infra (https://goo.gl/8tGc6O), which
27 is part of chrome tracing, and extracts it using timeline-based measurements.
28 """
29
30 def CreateTimelineBasedMeasurementOptions(self):
31 # Enable only memory-infra, to get memory dumps, and blink.console, to get
32 # the timeline markers used for mapping threads to tabs.
33 trace_memory = chrome_trace_category_filter.ChromeTraceCategoryFilter(
34 filter_string='-*,blink.console,disabled-by-default-memory-infra')
35 tbm_options = timeline_based_measurement.Options(
36 overhead_level=trace_memory)
37 tbm_options.config.enable_android_graphics_memtrack = True
38 tbm_options.SetTimelineBasedMetrics(['memoryMetric'])
39 # Setting an empty memory dump config disables periodic dumps.
40 tbm_options.config.chrome_trace_config.SetMemoryDumpConfig(
41 chrome_trace_config.MemoryDumpConfig())
42 return tbm_options
43
44
45 # TODO(bashi): Workaround for http://crbug.com/532075.
46 # @benchmark.Enabled('android') shouldn't be needed.
47 @benchmark.Enabled('android')
48 class MemoryBenchmarkTop10Mobile(_MemoryInfra):
49 """Measure foreground/background memory on top 10 mobile page set.
50
51 This metric provides memory measurements for the System Health Plan of
52 Chrome on Android.
53 """
54 page_set = page_sets.MemoryTop10Mobile
55 options = {'pageset_repeat': 5}
56
57 @classmethod
58 def Name(cls):
59 return 'memory.top_10_mobile'
60
61 @classmethod
62 def ShouldTearDownStateAfterEachStoryRun(cls):
63 return False
64
65 @classmethod
66 def ShouldDisable(cls, possible_browser):
67 # TODO(crbug.com/586148): Benchmark should not depend on DeskClock app.
68 return not possible_browser.platform.CanLaunchApplication(
69 'com.google.android.deskclock')
70
71 @classmethod
72 def ValueCanBeAddedPredicate(cls, value, is_first_result):
73 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard
74 # is able to cope with the data load generated by TBMv2 metrics.
75 return not _IGNORED_STATS_RE.search(value.name)
76
77
78 class MemoryBenchmarkTop10MobileStress(MemoryBenchmarkTop10Mobile):
79 """Run top 10 mobile page set without closing/restarting the browser.
80
81 This benchmark is intended to stress-test the browser, catching memory leaks
82 or possible crashes after interacting with the browser for a period of time.
83 """
84 page_set = page_sets.MemoryTop10MobileRealistic
85
86 @classmethod
87 def Name(cls):
88 return 'memory.top_10_mobile_stress'
89
90 @classmethod
91 def ShouldTearDownStateAfterEachStorySetRun(cls):
92 return False
93
94
95 # Benchmark disabled by default. Force to run with --also-run-disabled-tests.
96 @benchmark.Disabled('all')
97 class DualBrowserBenchmark(_MemoryInfra):
98 """Measures memory usage while interacting with two different browsers.
99
100 The user story involves going back and forth between doing Google searches
101 on a webview-based browser (a stand in for the Search app), and loading
102 pages on a select browser.
103 """
104 page_set = page_sets.DualBrowserStorySet
105 options = {'pageset_repeat': 5}
106
107 @classmethod
108 def Name(cls):
109 return 'memory.dual_browser_test'
110
111 @classmethod
112 def ShouldTearDownStateAfterEachStoryRun(cls):
113 return False
114
115 @classmethod
116 def ValueCanBeAddedPredicate(cls, value, is_first_result):
117 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard
118 # is able to cope with the data load generated by TBMv2 metrics.
119 return not _IGNORED_STATS_RE.search(value.name)
120
121
122 # Benchmark disabled by default. Force to run with --also-run-disabled-tests.
123 @benchmark.Disabled('all')
124 class LongRunningDualBrowserBenchmark(_MemoryInfra):
125 """Measures memory during prolonged usage of alternating browsers.
126
127 Same as memory.dual_browser_test, but the test is run for 60 iterations
128 and the browser is *not* restarted between page set repeats.
129 """
130 page_set = page_sets.DualBrowserStorySet
131 options = {'pageset_repeat': 60}
132
133 @classmethod
134 def Name(cls):
135 return 'memory.long_running_dual_browser_test'
136
137 @classmethod
138 def ShouldTearDownStateAfterEachStoryRun(cls):
139 return False
140
141 @classmethod
142 def ShouldTearDownStateAfterEachStorySetRun(cls):
143 return False
144
145 @classmethod
146 def ValueCanBeAddedPredicate(cls, value, is_first_result):
147 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard
148 # is able to cope with the data load generated by TBMv2 metrics.
149 return not _IGNORED_STATS_RE.search(value.name)
150
151
152 # TODO(bashi): Workaround for http://crbug.com/532075
153 # @benchmark.Enabled('android') shouldn't be needed.
154 @benchmark.Enabled('android')
155 class RendererMemoryBlinkMemoryMobile(_MemoryInfra):
156 """Timeline based benchmark for measuring memory consumption on mobile
157 sites on which blink's memory consumption is relatively high.
158 """
159 page_set = page_sets.BlinkMemoryMobilePageSet
160
161 def SetExtraBrowserOptions(self, options):
162 super(RendererMemoryBlinkMemoryMobile, self).SetExtraBrowserOptions(
163 options)
164 options.AppendExtraBrowserArgs([
165 # Ignore certs errors because record_wpr cannot handle certs correctly
166 # in some cases (e.g. WordPress).
167 '--ignore-certificate-errors',
168 ])
169
170 @classmethod
171 def Name(cls):
172 return 'memory.blink_memory_mobile'
173
174 @classmethod
175 def ValueCanBeAddedPredicate(cls, value, is_first_result):
176 return (not _IGNORED_STATS_RE.search(value.name) and
177 'renderer_processes' in value.name)
178
179 @classmethod
180 def ShouldDisable(cls, possible_browser):
181 # http://crbug.com/634319
182 return (possible_browser.browser_type == 'reference' and
183 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X')
184
185
186 class _MemoryV8Benchmark(_MemoryInfra):
187
188 # Report only V8-specific and overall renderer memory values. Note that
189 # detailed values reported by the OS (such as native heap) are excluded.
190 _V8_AND_OVERALL_MEMORY_RE = re.compile(
191 r'renderer_processes:'
192 r'(reported_by_chrome:v8|reported_by_os:system_memory:[^:]+$)')
193
194 def CreateTimelineBasedMeasurementOptions(self):
195 v8_categories = [
196 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console']
197 memory_categories = ['blink.console', 'disabled-by-default-memory-infra']
198 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter(
199 ','.join(['-*'] + v8_categories + memory_categories))
200 options = timeline_based_measurement.Options(category_filter)
201 options.SetTimelineBasedMetrics(['v8AndMemoryMetrics'])
202 # Setting an empty memory dump config disables periodic dumps.
203 options.config.chrome_trace_config.SetMemoryDumpConfig(
204 chrome_trace_config.MemoryDumpConfig())
205 return options
206
207 @classmethod
208 def ValueCanBeAddedPredicate(cls, value, _):
209 if 'memory:chrome' in value.name:
210 # TODO(petrcermak): Remove the first two cases once
211 # https://codereview.chromium.org/2018503002/ lands in Catapult and rolls
212 # into Chromium.
213 return ('renderer:subsystem:v8' in value.name or
214 'renderer:vmstats:overall' in value.name or
215 bool(cls._V8_AND_OVERALL_MEMORY_RE.search(value.name)))
216 return 'v8' in value.name
217
218
219 class MemoryLongRunningIdleGmail(_MemoryV8Benchmark):
220 """Use (recorded) real world web sites and measure memory consumption
221 of long running idle Gmail page """
222 page_set = page_sets.LongRunningIdleGmailPageSet
223
224 @classmethod
225 def Name(cls):
226 return 'memory.long_running_idle_gmail_tbmv2'
227
228 @classmethod
229 def ShouldDisable(cls, possible_browser):
230 return cls.IsSvelte(possible_browser) # http://crbug.com/611167
231
232
233 @benchmark.Enabled('has tabs') # http://crbug.com/612210
234 class MemoryLongRunningIdleGmailBackground(_MemoryV8Benchmark):
235 """Use (recorded) real world web sites and measure memory consumption
236 of long running idle Gmail page """
237 page_set = page_sets.LongRunningIdleGmailBackgroundPageSet
238
239 @classmethod
240 def Name(cls):
241 return 'memory.long_running_idle_gmail_background_tbmv2'
242
243 @classmethod
244 def ShouldDisable(cls, possible_browser): # http://crbug.com/616530
245 return cls.IsSvelte(possible_browser)
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/memory.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698