OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 re | 5 import re |
6 | 6 |
7 from core import perf_benchmark | 7 from core import perf_benchmark |
8 | 8 |
9 from telemetry import benchmark | 9 from telemetry import benchmark |
10 from telemetry.timeline import chrome_trace_category_filter | 10 from telemetry.timeline import chrome_trace_category_filter |
| 11 from telemetry.timeline import chrome_trace_config |
11 from telemetry.web_perf import timeline_based_measurement | 12 from telemetry.web_perf import timeline_based_measurement |
12 | 13 |
13 import page_sets | 14 import page_sets |
14 | 15 |
15 | 16 |
16 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames() | 17 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames() |
17 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value
/numeric.html#L323 | 18 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value
/numeric.html#L323 |
18 _IGNORED_STATS_RE = re.compile( | 19 _IGNORED_STATS_RE = re.compile( |
19 r'(?<!dump)(?<!process)_(std|count|max|min|sum|pct_\d{4}(_\d+)?)$') | 20 r'(?<!dump)(?<!process)_(std|count|max|min|sum|pct_\d{4}(_\d+)?)$') |
20 | 21 |
21 | 22 |
22 class _MemoryInfra(perf_benchmark.PerfBenchmark): | 23 class _MemoryInfra(perf_benchmark.PerfBenchmark): |
23 """Base class for new-generation memory benchmarks based on memory-infra. | 24 """Base class for new-generation memory benchmarks based on memory-infra. |
24 | 25 |
25 This benchmark records data using memory-infra (https://goo.gl/8tGc6O), which | 26 This benchmark records data using memory-infra (https://goo.gl/8tGc6O), which |
26 is part of chrome tracing, and extracts it using timeline-based measurements. | 27 is part of chrome tracing, and extracts it using timeline-based measurements. |
27 """ | 28 """ |
28 | 29 |
29 def SetExtraBrowserOptions(self, options): | |
30 options.AppendExtraBrowserArgs([ | |
31 # TODO(perezju): Temporary workaround to disable periodic memory dumps. | |
32 # See: http://crbug.com/513692 | |
33 '--enable-memory-benchmarking', | |
34 ]) | |
35 | |
36 def CreateTimelineBasedMeasurementOptions(self): | 30 def CreateTimelineBasedMeasurementOptions(self): |
37 # Enable only memory-infra, to get memory dumps, and blink.console, to get | 31 # Enable only memory-infra, to get memory dumps, and blink.console, to get |
38 # the timeline markers used for mapping threads to tabs. | 32 # the timeline markers used for mapping threads to tabs. |
39 trace_memory = chrome_trace_category_filter.ChromeTraceCategoryFilter( | 33 trace_memory = chrome_trace_category_filter.ChromeTraceCategoryFilter( |
40 filter_string='-*,blink.console,disabled-by-default-memory-infra') | 34 filter_string='-*,blink.console,disabled-by-default-memory-infra') |
41 tbm_options = timeline_based_measurement.Options( | 35 tbm_options = timeline_based_measurement.Options( |
42 overhead_level=trace_memory) | 36 overhead_level=trace_memory) |
43 tbm_options.config.enable_android_graphics_memtrack = True | 37 tbm_options.config.enable_android_graphics_memtrack = True |
44 tbm_options.SetTimelineBasedMetrics(['memoryMetric']) | 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()) |
45 return tbm_options | 42 return tbm_options |
46 | 43 |
47 | 44 |
48 # TODO(bashi): Workaround for http://crbug.com/532075. | 45 # TODO(bashi): Workaround for http://crbug.com/532075. |
49 # @benchmark.Enabled('android') shouldn't be needed. | 46 # @benchmark.Enabled('android') shouldn't be needed. |
50 @benchmark.Enabled('android') | 47 @benchmark.Enabled('android') |
51 class MemoryBenchmarkTop10Mobile(_MemoryInfra): | 48 class MemoryBenchmarkTop10Mobile(_MemoryInfra): |
52 """Measure foreground/background memory on top 10 mobile page set. | 49 """Measure foreground/background memory on top 10 mobile page set. |
53 | 50 |
54 This metric provides memory measurements for the System Health Plan of | 51 This metric provides memory measurements for the System Health Plan of |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 r'(reported_by_chrome:v8|reported_by_os:system_memory:[^:]+$)') | 192 r'(reported_by_chrome:v8|reported_by_os:system_memory:[^:]+$)') |
196 | 193 |
197 def CreateTimelineBasedMeasurementOptions(self): | 194 def CreateTimelineBasedMeasurementOptions(self): |
198 v8_categories = [ | 195 v8_categories = [ |
199 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] | 196 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] |
200 memory_categories = ['blink.console', 'disabled-by-default-memory-infra'] | 197 memory_categories = ['blink.console', 'disabled-by-default-memory-infra'] |
201 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter( | 198 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter( |
202 ','.join(['-*'] + v8_categories + memory_categories)) | 199 ','.join(['-*'] + v8_categories + memory_categories)) |
203 options = timeline_based_measurement.Options(category_filter) | 200 options = timeline_based_measurement.Options(category_filter) |
204 options.SetTimelineBasedMetrics(['v8AndMemoryMetrics']) | 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 | 205 return options |
206 | 206 |
207 @classmethod | 207 @classmethod |
208 def ValueCanBeAddedPredicate(cls, value, _): | 208 def ValueCanBeAddedPredicate(cls, value, _): |
209 if 'memory:chrome' in value.name: | 209 if 'memory:chrome' in value.name: |
210 # TODO(petrcermak): Remove the first two cases once | 210 # TODO(petrcermak): Remove the first two cases once |
211 # https://codereview.chromium.org/2018503002/ lands in Catapult and rolls | 211 # https://codereview.chromium.org/2018503002/ lands in Catapult and rolls |
212 # into Chromium. | 212 # into Chromium. |
213 return ('renderer:subsystem:v8' in value.name or | 213 return ('renderer:subsystem:v8' in value.name or |
214 'renderer:vmstats:overall' in value.name or | 214 'renderer:vmstats:overall' in value.name or |
(...skipping 21 matching lines...) Expand all Loading... |
236 of long running idle Gmail page """ | 236 of long running idle Gmail page """ |
237 page_set = page_sets.LongRunningIdleGmailBackgroundPageSet | 237 page_set = page_sets.LongRunningIdleGmailBackgroundPageSet |
238 | 238 |
239 @classmethod | 239 @classmethod |
240 def Name(cls): | 240 def Name(cls): |
241 return 'memory.long_running_idle_gmail_background_tbmv2' | 241 return 'memory.long_running_idle_gmail_background_tbmv2' |
242 | 242 |
243 @classmethod | 243 @classmethod |
244 def ShouldDisable(cls, possible_browser): # http://crbug.com/616530 | 244 def ShouldDisable(cls, possible_browser): # http://crbug.com/616530 |
245 return cls.IsSvelte(possible_browser) | 245 return cls.IsSvelte(possible_browser) |
OLD | NEW |