| 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 13 matching lines...) Expand all Loading... |
| 36 tbm_options = timeline_based_measurement.Options( | 37 tbm_options = timeline_based_measurement.Options( |
| 37 overhead_level=trace_memory) | 38 overhead_level=trace_memory) |
| 38 tbm_options.config.enable_android_graphics_memtrack = True | 39 tbm_options.config.enable_android_graphics_memtrack = True |
| 39 return tbm_options | 40 return tbm_options |
| 40 | 41 |
| 41 @classmethod | 42 @classmethod |
| 42 def HasBenchmarkTraceRerunDebugOption(cls): | 43 def HasBenchmarkTraceRerunDebugOption(cls): |
| 43 return True | 44 return True |
| 44 | 45 |
| 45 def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): | 46 def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): |
| 47 # TODO(perezju): Call this function for TBM benchmarks: crbug.com/593678 |
| 46 tbm_options.SetLegacyTimelineBasedMetrics(( | 48 tbm_options.SetLegacyTimelineBasedMetrics(( |
| 47 memory_timeline.MemoryTimelineMetric(), | 49 memory_timeline.MemoryTimelineMetric(), |
| 48 )) | 50 )) |
| 49 | 51 |
| 50 | 52 |
| 51 # TODO(bashi): Workaround for http://crbug.com/532075 | 53 # TODO(bashi): Workaround for http://crbug.com/532075 |
| 52 # @benchmark.Enabled('android') shouldn't be needed. | 54 # @benchmark.Enabled('android') shouldn't be needed. |
| 53 @benchmark.Enabled('android') | 55 @benchmark.Enabled('android') |
| 54 class MemoryHealthPlan(_MemoryInfra): | 56 class MemoryHealthPlan(_MemoryInfra): |
| 55 """Timeline based benchmark for the Memory Health Plan.""" | 57 """Timeline based benchmark for the Memory Health Plan.""" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 # Tracing.requestMemoryDump DevTools API. See http://crbug.com/540022. | 110 # Tracing.requestMemoryDump DevTools API. See http://crbug.com/540022. |
| 109 @benchmark.Disabled('reference') | 111 @benchmark.Disabled('reference') |
| 110 class MemoryBenchmarkTop10Mobile(_MemoryInfra): | 112 class MemoryBenchmarkTop10Mobile(_MemoryInfra): |
| 111 """Timeline based benchmark for measuring memory on top 10 mobile sites.""" | 113 """Timeline based benchmark for measuring memory on top 10 mobile sites.""" |
| 112 | 114 |
| 113 page_set = page_sets.MemoryInfraTop10MobilePageSet | 115 page_set = page_sets.MemoryInfraTop10MobilePageSet |
| 114 | 116 |
| 115 @classmethod | 117 @classmethod |
| 116 def Name(cls): | 118 def Name(cls): |
| 117 return 'memory.top_10_mobile' | 119 return 'memory.top_10_mobile' |
| 120 |
| 121 |
| 122 # Disabled on reference builds because they don't support the new |
| 123 # Tracing.requestMemoryDump DevTools API. |
| 124 # For 'reference' see http://crbug.com/540022. |
| 125 # For 'android' see http://crbug.com/579546. |
| 126 @benchmark.Disabled('reference', 'android') |
| 127 class MemoryLongRunningIdleGmailTBM(_MemoryInfra): |
| 128 """Use (recorded) real world web sites and measure memory consumption |
| 129 of long running idle Gmail page """ |
| 130 page_set = page_sets.LongRunningIdleGmailPageSet |
| 131 |
| 132 def CreateTimelineBasedMeasurementOptions(self): |
| 133 v8_categories = [ |
| 134 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] |
| 135 memory_categories = 'blink.console,disabled-by-default-memory-infra' |
| 136 category_filter = tracing_category_filter.TracingCategoryFilter( |
| 137 memory_categories) |
| 138 for category in v8_categories: |
| 139 category_filter.AddIncludedCategory(category) |
| 140 options = timeline_based_measurement.Options(category_filter) |
| 141 options.SetLegacyTimelineBasedMetrics([ |
| 142 v8_gc_latency.V8GCLatency(), |
| 143 memory_timeline.MemoryTimelineMetric()]) |
| 144 return options |
| 145 |
| 146 @classmethod |
| 147 def Name(cls): |
| 148 return 'memory.long_running_idle_gmail_tbm' |
| 149 |
| 150 @classmethod |
| 151 def ShouldTearDownStateAfterEachStoryRun(cls): |
| 152 return True |
| OLD | NEW |