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