| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 144 |
| 146 @classmethod | 145 @classmethod |
| 147 def Name(cls): | 146 def Name(cls): |
| 148 return 'memory.blink_memory_mobile' | 147 return 'memory.blink_memory_mobile' |
| 149 | 148 |
| 150 @classmethod | 149 @classmethod |
| 151 def ValueCanBeAddedPredicate(cls, value, is_first_result): | 150 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 152 return bool(cls._RE_RENDERER_VALUES.match(value.name)) | 151 return bool(cls._RE_RENDERER_VALUES.match(value.name)) |
| 153 | 152 |
| 154 | 153 |
| 154 class _MemoryV8Benchmark(_MemoryInfra): |
| 155 def CreateTimelineBasedMeasurementOptions(self): |
| 156 v8_categories = [ |
| 157 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] |
| 158 memory_categories = ['blink.console', 'disabled-by-default-memory-infra'] |
| 159 category_filter = tracing_category_filter.TracingCategoryFilter( |
| 160 ','.join(['-*'] + v8_categories + memory_categories)) |
| 161 options = timeline_based_measurement.Options(category_filter) |
| 162 options.SetTimelineBasedMetric('v8AndMemoryMetrics') |
| 163 return options |
| 164 |
| 165 |
| 155 # Disabled on reference builds because they don't support the new | 166 # Disabled on reference builds because they don't support the new |
| 156 # Tracing.requestMemoryDump DevTools API. | 167 # Tracing.requestMemoryDump DevTools API. |
| 157 # For 'reference' see http://crbug.com/540022. | 168 # For 'reference' see http://crbug.com/540022. |
| 158 # For 'android' see http://crbug.com/579546. | 169 # For 'android' see http://crbug.com/579546. |
| 159 @benchmark.Disabled('reference', 'android') | 170 @benchmark.Disabled('reference', 'android') |
| 160 class MemoryLongRunningIdleGmailTBM(_MemoryInfra): | 171 class MemoryLongRunningIdleGmail(_MemoryV8Benchmark): |
| 161 """Use (recorded) real world web sites and measure memory consumption | 172 """Use (recorded) real world web sites and measure memory consumption |
| 162 of long running idle Gmail page """ | 173 of long running idle Gmail page """ |
| 163 page_set = page_sets.LongRunningIdleGmailPageSet | 174 page_set = page_sets.LongRunningIdleGmailPageSet |
| 164 | 175 |
| 165 def CreateTimelineBasedMeasurementOptions(self): | 176 @classmethod |
| 166 v8_categories = [ | 177 def Name(cls): |
| 167 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] | 178 return 'memory.long_running_idle_gmail_tbmv2' |
| 168 memory_categories = 'blink.console,disabled-by-default-memory-infra' | |
| 169 category_filter = tracing_category_filter.TracingCategoryFilter( | |
| 170 memory_categories) | |
| 171 for category in v8_categories: | |
| 172 category_filter.AddIncludedCategory(category) | |
| 173 options = timeline_based_measurement.Options(category_filter) | |
| 174 return options | |
| 175 | 179 |
| 176 def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): | 180 |
| 177 tbm_options.SetLegacyTimelineBasedMetrics(( | 181 # Disabled on reference builds because they don't support the new |
| 178 v8_gc_latency.V8GCLatency(), | 182 # Tracing.requestMemoryDump DevTools API. |
| 179 memory_timeline.MemoryTimelineMetric(), | 183 # For 'reference' see http://crbug.com/540022. |
| 180 )) | 184 # For 'android' see http://crbug.com/579546. |
| 185 @benchmark.Disabled('reference', 'android') |
| 186 class MemoryLongRunningIdleGmailBackground(_MemoryV8Benchmark): |
| 187 """Use (recorded) real world web sites and measure memory consumption |
| 188 of long running idle Gmail page """ |
| 189 page_set = page_sets.LongRunningIdleGmailBackgroundPageSet |
| 181 | 190 |
| 182 @classmethod | 191 @classmethod |
| 183 def Name(cls): | 192 def Name(cls): |
| 184 return 'memory.long_running_idle_gmail_tbm' | 193 return 'memory.long_running_idle_gmail_background_tbmv2' |
| 185 | |
| 186 @classmethod | |
| 187 def ShouldTearDownStateAfterEachStoryRun(cls): | |
| 188 return True | |
| OLD | NEW |