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 | |
14 | 13 |
15 import page_sets | 14 import page_sets |
16 | 15 |
17 | 16 |
18 class _MemoryInfra(perf_benchmark.PerfBenchmark): | 17 class _MemoryInfra(perf_benchmark.PerfBenchmark): |
19 """Base class for new-generation memory benchmarks based on memory-infra. | 18 """Base class for new-generation memory benchmarks based on memory-infra. |
20 | 19 |
21 This benchmark records data using memory-infra (https://goo.gl/8tGc6O), which | 20 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. | 21 is part of chrome tracing, and extracts it using timeline-based measurements. |
23 """ | 22 """ |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 class MemoryBenchmarkTop10Mobile(_MemoryInfra): | 136 class MemoryBenchmarkTop10Mobile(_MemoryInfra): |
138 """Timeline based benchmark for measuring memory on top 10 mobile sites.""" | 137 """Timeline based benchmark for measuring memory on top 10 mobile sites.""" |
139 | 138 |
140 page_set = page_sets.MemoryInfraTop10MobilePageSet | 139 page_set = page_sets.MemoryInfraTop10MobilePageSet |
141 | 140 |
142 @classmethod | 141 @classmethod |
143 def Name(cls): | 142 def Name(cls): |
144 return 'memory.top_10_mobile' | 143 return 'memory.top_10_mobile' |
145 | 144 |
146 | 145 |
| 146 class _MemoryV8Benchmark(_MemoryInfra): |
| 147 def CreateTimelineBasedMeasurementOptions(self): |
| 148 v8_categories = [ |
| 149 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] |
| 150 memory_categories = ['blink.console', 'disabled-by-default-memory-infra'] |
| 151 category_filter = tracing_category_filter.TracingCategoryFilter( |
| 152 ','.join(['-*'] + v8_categories + memory_categories)) |
| 153 options = timeline_based_measurement.Options(category_filter) |
| 154 options.SetTimelineBasedMetric('v8AndMemoryMetrics') |
| 155 return options |
| 156 |
| 157 |
| 158 |
147 # Disabled on reference builds because they don't support the new | 159 # Disabled on reference builds because they don't support the new |
148 # Tracing.requestMemoryDump DevTools API. | 160 # Tracing.requestMemoryDump DevTools API. |
149 # For 'reference' see http://crbug.com/540022. | 161 # For 'reference' see http://crbug.com/540022. |
150 # For 'android' see http://crbug.com/579546. | 162 # For 'android' see http://crbug.com/579546. |
151 @benchmark.Disabled('reference', 'android') | 163 @benchmark.Disabled('reference', 'android') |
152 class MemoryLongRunningIdleGmailTBM(_MemoryInfra): | 164 class MemoryLongRunningIdleGmail(_MemoryV8Benchmark): |
153 """Use (recorded) real world web sites and measure memory consumption | 165 """Use (recorded) real world web sites and measure memory consumption |
154 of long running idle Gmail page """ | 166 of long running idle Gmail page """ |
155 page_set = page_sets.LongRunningIdleGmailPageSet | 167 page_set = page_sets.LongRunningIdleGmailPageSet |
156 | 168 |
157 def CreateTimelineBasedMeasurementOptions(self): | 169 @classmethod |
158 v8_categories = [ | 170 def Name(cls): |
159 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] | 171 return 'memory.long_running_idle_gmail_tbmv2' |
160 memory_categories = 'blink.console,disabled-by-default-memory-infra' | |
161 category_filter = tracing_category_filter.TracingCategoryFilter( | |
162 memory_categories) | |
163 for category in v8_categories: | |
164 category_filter.AddIncludedCategory(category) | |
165 options = timeline_based_measurement.Options(category_filter) | |
166 return options | |
167 | 172 |
168 def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): | 173 |
169 tbm_options.SetLegacyTimelineBasedMetrics(( | 174 # Disabled on reference builds because they don't support the new |
170 v8_gc_latency.V8GCLatency(), | 175 # Tracing.requestMemoryDump DevTools API. |
171 memory_timeline.MemoryTimelineMetric(), | 176 # For 'reference' see http://crbug.com/540022. |
172 )) | 177 # For 'android' see http://crbug.com/579546. |
| 178 @benchmark.Disabled('reference', 'android') |
| 179 class MemoryLongRunningIdleGmailBackground(_MemoryV8Benchmark): |
| 180 """Use (recorded) real world web sites and measure memory consumption |
| 181 of long running idle Gmail page """ |
| 182 page_set = page_sets.LongRunningIdleGmailBackgroundPageSet |
173 | 183 |
174 @classmethod | 184 @classmethod |
175 def Name(cls): | 185 def Name(cls): |
176 return 'memory.long_running_idle_gmail_tbm' | 186 return 'memory.long_running_idle_gmail_background_tbmv2' |
177 | |
178 @classmethod | |
179 def ShouldTearDownStateAfterEachStoryRun(cls): | |
180 return True | |
OLD | NEW |