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 tracing_category_filter | 10 from telemetry.timeline import tracing_category_filter |
11 from telemetry.web_perf import timeline_based_measurement | 11 from telemetry.web_perf import timeline_based_measurement |
12 from telemetry.web_perf.metrics import memory_timeline | 12 from telemetry.web_perf.metrics import memory_timeline |
13 from telemetry.web_perf.metrics import v8_gc_latency | 13 from telemetry.web_perf.metrics import v8_gc_latency |
14 | 14 |
15 import page_sets | 15 import page_sets |
16 | 16 |
17 | 17 |
18 class _MemoryInfra(perf_benchmark.PerfBenchmark): | 18 class _MemoryInfra(perf_benchmark.PerfBenchmark): |
19 """Base class for new-generation memory benchmarks based on memory-infra. | 19 """Base class for new-generation memory benchmarks based on memory-infra. |
20 | 20 |
21 This benchmark records data using memory-infra (https://goo.gl/8tGc6O), which | 21 This benchmark records data using memory-infra (https://goo.gl/8tGc6O), which |
22 is part of chrome tracing, and extracts it using timeline-based measurements. | 22 is part of chrome tracing, and extracts it using timeline-based measurements. |
23 """ | 23 """ |
24 | 24 |
25 # Subclasses can override this to use TBMv2 instead of TBMv1. | |
26 TBM_VERSION = 1 | |
27 | |
25 def SetExtraBrowserOptions(self, options): | 28 def SetExtraBrowserOptions(self, options): |
26 options.AppendExtraBrowserArgs([ | 29 options.AppendExtraBrowserArgs([ |
27 # TODO(perezju): Temporary workaround to disable periodic memory dumps. | 30 # TODO(perezju): Temporary workaround to disable periodic memory dumps. |
28 # See: http://crbug.com/513692 | 31 # See: http://crbug.com/513692 |
29 '--enable-memory-benchmarking', | 32 '--enable-memory-benchmarking', |
30 ]) | 33 ]) |
31 | 34 |
32 def CreateTimelineBasedMeasurementOptions(self): | 35 def CreateTimelineBasedMeasurementOptions(self): |
33 # Enable only memory-infra, to get memory dumps, and blink.console, to get | 36 # Enable only memory-infra, to get memory dumps, and blink.console, to get |
34 # the timeline markers used for mapping threads to tabs. | 37 # the timeline markers used for mapping threads to tabs. |
35 trace_memory = tracing_category_filter.TracingCategoryFilter( | 38 trace_memory = tracing_category_filter.TracingCategoryFilter( |
36 filter_string='-*,blink.console,disabled-by-default-memory-infra') | 39 filter_string='-*,blink.console,disabled-by-default-memory-infra') |
37 tbm_options = timeline_based_measurement.Options( | 40 tbm_options = timeline_based_measurement.Options( |
38 overhead_level=trace_memory) | 41 overhead_level=trace_memory) |
39 tbm_options.config.enable_android_graphics_memtrack = True | 42 tbm_options.config.enable_android_graphics_memtrack = True |
43 if self.TBM_VERSION == 1: | |
44 # TBMv1 (see telemetry/telemetry/web_perf/metrics/memory_timeline.py | |
45 # in third_party/catapult). | |
46 tbm_options.SetLegacyTimelineBasedMetrics(( | |
47 memory_timeline.MemoryTimelineMetric(), | |
48 )) | |
49 elif self.TBM_VERSION == 2: | |
50 # TBMv2 (see tracing/tracing/metrics/system_health/memory_metric.html | |
51 # in third_party/catapult). | |
52 tbm_options.SetTimelineBasedMetric('memoryMetric') | |
53 else: | |
54 raise Exception('Unrecognized TBM version: %s' % self.TBM_VERSION) | |
40 return tbm_options | 55 return tbm_options |
41 | 56 |
42 @classmethod | |
43 def HasTraceRerunDebugOption(cls): | |
44 return True | |
45 | |
46 def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): | |
47 tbm_options.SetLegacyTimelineBasedMetrics(( | |
48 memory_timeline.MemoryTimelineMetric(), | |
49 )) | |
50 | |
51 | 57 |
52 # TODO(bashi): Workaround for http://crbug.com/532075 | 58 # TODO(bashi): Workaround for http://crbug.com/532075 |
53 # @benchmark.Enabled('android') shouldn't be needed. | 59 # @benchmark.Enabled('android') shouldn't be needed. |
54 @benchmark.Enabled('android') | 60 @benchmark.Enabled('android') |
55 class MemoryHealthQuick(_MemoryInfra): | 61 class MemoryHealthQuick(_MemoryInfra): |
56 """Timeline based benchmark for the Memory Health Plan (1 iteration).""" | 62 """Timeline based benchmark for the Memory Health Plan (1 iteration).""" |
57 page_set = page_sets.MemoryHealthStory | 63 page_set = page_sets.MemoryHealthStory |
58 | 64 |
59 @classmethod | 65 @classmethod |
60 def Name(cls): | 66 def Name(cls): |
(...skipping 10 matching lines...) Expand all Loading... | |
71 @benchmark.Disabled('all') | 77 @benchmark.Disabled('all') |
72 class MemoryHealthPlan(MemoryHealthQuick): | 78 class MemoryHealthPlan(MemoryHealthQuick): |
73 """Timeline based benchmark for the Memory Health Plan (5 iterations).""" | 79 """Timeline based benchmark for the Memory Health Plan (5 iterations).""" |
74 options = {'pageset_repeat': 5} | 80 options = {'pageset_repeat': 5} |
75 | 81 |
76 @classmethod | 82 @classmethod |
77 def Name(cls): | 83 def Name(cls): |
78 return 'memory.memory_health_plan' | 84 return 'memory.memory_health_plan' |
79 | 85 |
80 | 86 |
87 @benchmark.Enabled('android') | |
88 class TBMv2MemoryBenchmarkTop10Mobile(MemoryHealthQuick): | |
89 """Timeline based benchmark for the Memory Health Plan based on TBMv2. | |
90 | |
91 This is a temporary benchmark to compare the new TBMv2 memory metric | |
92 (memory_metric.html) with the existing TBMv1 one (memory_timeline.py). Once | |
93 all issues associated with the TBMv2 metric are resolved, all memory | |
94 benchmarks (including the ones in this file) will switch to use it instead | |
95 of the TBMv1 metric and this temporary benchmark will be removed. | |
Primiano Tucci (use gerrit)
2016/04/25 16:14:55
Add a link to crbug.com/606361 which has all the c
petrcermak
2016/04/25 16:31:23
Done.
| |
96 """ | |
97 TBM_VERSION = 2 | |
98 | |
99 @classmethod | |
100 def Name(cls): | |
101 return 'memory.top_10_mobile_tbmv2' | |
102 | |
103 | |
81 # TODO(bashi): Workaround for http://crbug.com/532075 | 104 # TODO(bashi): Workaround for http://crbug.com/532075 |
82 # @benchmark.Enabled('android') shouldn't be needed. | 105 # @benchmark.Enabled('android') shouldn't be needed. |
83 @benchmark.Enabled('android') | 106 @benchmark.Enabled('android') |
84 class RendererMemoryBlinkMemoryMobile(_MemoryInfra): | 107 class RendererMemoryBlinkMemoryMobile(_MemoryInfra): |
85 """Timeline based benchmark for measuring memory consumption on mobile | 108 """Timeline based benchmark for measuring memory consumption on mobile |
86 sites on which blink's memory consumption is relatively high.""" | 109 sites on which blink's memory consumption is relatively high.""" |
87 | 110 |
88 _RE_RENDERER_VALUES = re.compile('memory_.+_renderer') | 111 _RE_RENDERER_VALUES = re.compile('memory_.+_renderer') |
89 | 112 |
90 page_set = page_sets.BlinkMemoryMobilePageSet | 113 page_set = page_sets.BlinkMemoryMobilePageSet |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 memory_timeline.MemoryTimelineMetric(), | 170 memory_timeline.MemoryTimelineMetric(), |
148 )) | 171 )) |
149 | 172 |
150 @classmethod | 173 @classmethod |
151 def Name(cls): | 174 def Name(cls): |
152 return 'memory.long_running_idle_gmail_tbm' | 175 return 'memory.long_running_idle_gmail_tbm' |
153 | 176 |
154 @classmethod | 177 @classmethod |
155 def ShouldTearDownStateAfterEachStoryRun(cls): | 178 def ShouldTearDownStateAfterEachStoryRun(cls): |
156 return True | 179 return True |
OLD | NEW |