OLD | NEW |
| (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.timeline import tracing_category_filter | |
10 from telemetry.web_perf import timeline_based_measurement | |
11 | |
12 import page_sets | |
13 | |
14 | |
15 class _MemoryBenchmark(perf_benchmark.PerfBenchmark): | |
16 """Base class for timeline based memory benchmarks.""" | |
17 | |
18 def SetExtraBrowserOptions(self, options): | |
19 # TODO(perezju): Temporary workaround to disable periodic memory dumps. | |
20 # See: http://crbug.com/513692 | |
21 options.AppendExtraBrowserArgs('--enable-memory-benchmarking') | |
22 | |
23 def CreateTimelineBasedMeasurementOptions(self): | |
24 # Enable only memory-infra, to get memory dumps, and blink.console, to get | |
25 # the timeline markers used for mapping threads to tabs. | |
26 trace_memory = tracing_category_filter.TracingCategoryFilter( | |
27 filter_string='-*,blink.console,disabled-by-default-memory-infra') | |
28 return timeline_based_measurement.Options(overhead_level=trace_memory) | |
29 | |
30 | |
31 class MemoryHealthPlan(_MemoryBenchmark): | |
32 """Timeline based benchmark for the Memory Health Plan.""" | |
33 | |
34 _RE_BENCHMARK_VALUES = re.compile('(fore|back)ground-memory_') | |
35 | |
36 page_set = page_sets.MemoryHealthStory | |
37 | |
38 @classmethod | |
39 def Name(cls): | |
40 return 'memory.memory_health_plan' | |
41 | |
42 @classmethod | |
43 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
44 return bool(cls._RE_BENCHMARK_VALUES.match(value.name)) | |
45 | |
46 | |
47 class RendererMemoryBlinkMemoryMobile(_MemoryBenchmark): | |
48 """Timeline based benchmark for measuring memory consumption on mobile | |
49 sites on which blink's memory consumption is relatively high.""" | |
50 | |
51 _RE_RENDERER_VALUES = re.compile('.+-memory_.+_renderer') | |
52 | |
53 page_set = page_sets.BlinkMemoryMobilePageSet | |
54 | |
55 def SetExtraBrowserOptions(self, options): | |
56 super(RendererMemoryBlinkMemoryMobile, self).SetExtraBrowserOptions( | |
57 options) | |
58 options.AppendExtraBrowserArgs([ | |
59 # TODO(bashi): Temporary workaround for http://crbug.com/461788 | |
60 '--no-sandbox', | |
61 # Ignore certs errors because record_wpr cannot handle certs correctly | |
62 # in some cases (e.g. WordPress). | |
63 '--ignore-certificate-errors', | |
64 ]) | |
65 | |
66 @classmethod | |
67 def Name(cls): | |
68 return 'memory.blink_memory_mobile' | |
69 | |
70 @classmethod | |
71 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
72 return bool(cls._RE_RENDERER_VALUES.match(value.name)) | |
OLD | NEW |