| 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 | |
| 28 def SetExtraBrowserOptions(self, options): | 25 def SetExtraBrowserOptions(self, options): |
| 29 options.AppendExtraBrowserArgs([ | 26 options.AppendExtraBrowserArgs([ |
| 30 # TODO(perezju): Temporary workaround to disable periodic memory dumps. | 27 # TODO(perezju): Temporary workaround to disable periodic memory dumps. |
| 31 # See: http://crbug.com/513692 | 28 # See: http://crbug.com/513692 |
| 32 '--enable-memory-benchmarking', | 29 '--enable-memory-benchmarking', |
| 33 ]) | 30 ]) |
| 34 | 31 |
| 35 def CreateTimelineBasedMeasurementOptions(self): | 32 def CreateTimelineBasedMeasurementOptions(self): |
| 36 # Enable only memory-infra, to get memory dumps, and blink.console, to get | 33 # Enable only memory-infra, to get memory dumps, and blink.console, to get |
| 37 # the timeline markers used for mapping threads to tabs. | 34 # the timeline markers used for mapping threads to tabs. |
| 38 trace_memory = tracing_category_filter.TracingCategoryFilter( | 35 trace_memory = tracing_category_filter.TracingCategoryFilter( |
| 39 filter_string='-*,blink.console,disabled-by-default-memory-infra') | 36 filter_string='-*,blink.console,disabled-by-default-memory-infra') |
| 40 tbm_options = timeline_based_measurement.Options( | 37 tbm_options = timeline_based_measurement.Options( |
| 41 overhead_level=trace_memory) | 38 overhead_level=trace_memory) |
| 42 tbm_options.config.enable_android_graphics_memtrack = True | 39 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) | |
| 55 return tbm_options | 40 return tbm_options |
| 56 | 41 |
| 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 |
| 57 | 51 |
| 58 # TODO(bashi): Workaround for http://crbug.com/532075 | 52 # TODO(bashi): Workaround for http://crbug.com/532075 |
| 59 # @benchmark.Enabled('android') shouldn't be needed. | 53 # @benchmark.Enabled('android') shouldn't be needed. |
| 60 @benchmark.Enabled('android') | 54 @benchmark.Enabled('android') |
| 61 class MemoryHealthQuick(_MemoryInfra): | 55 class MemoryHealthQuick(_MemoryInfra): |
| 62 """Timeline based benchmark for the Memory Health Plan (1 iteration).""" | 56 """Timeline based benchmark for the Memory Health Plan (1 iteration).""" |
| 63 page_set = page_sets.MemoryHealthStory | 57 page_set = page_sets.MemoryHealthStory |
| 64 | 58 |
| 65 @classmethod | 59 @classmethod |
| 66 def Name(cls): | 60 def Name(cls): |
| (...skipping 10 matching lines...) Expand all Loading... |
| 77 @benchmark.Disabled('all') | 71 @benchmark.Disabled('all') |
| 78 class MemoryHealthPlan(MemoryHealthQuick): | 72 class MemoryHealthPlan(MemoryHealthQuick): |
| 79 """Timeline based benchmark for the Memory Health Plan (5 iterations).""" | 73 """Timeline based benchmark for the Memory Health Plan (5 iterations).""" |
| 80 options = {'pageset_repeat': 5} | 74 options = {'pageset_repeat': 5} |
| 81 | 75 |
| 82 @classmethod | 76 @classmethod |
| 83 def Name(cls): | 77 def Name(cls): |
| 84 return 'memory.memory_health_plan' | 78 return 'memory.memory_health_plan' |
| 85 | 79 |
| 86 | 80 |
| 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. See | |
| 96 crbug.com/60361. | |
| 97 """ | |
| 98 TBM_VERSION = 2 | |
| 99 | |
| 100 @classmethod | |
| 101 def Name(cls): | |
| 102 return 'memory.top_10_mobile_tbmv2' | |
| 103 | |
| 104 | |
| 105 # TODO(bashi): Workaround for http://crbug.com/532075 | 81 # TODO(bashi): Workaround for http://crbug.com/532075 |
| 106 # @benchmark.Enabled('android') shouldn't be needed. | 82 # @benchmark.Enabled('android') shouldn't be needed. |
| 107 @benchmark.Enabled('android') | 83 @benchmark.Enabled('android') |
| 108 class RendererMemoryBlinkMemoryMobile(_MemoryInfra): | 84 class RendererMemoryBlinkMemoryMobile(_MemoryInfra): |
| 109 """Timeline based benchmark for measuring memory consumption on mobile | 85 """Timeline based benchmark for measuring memory consumption on mobile |
| 110 sites on which blink's memory consumption is relatively high.""" | 86 sites on which blink's memory consumption is relatively high.""" |
| 111 | 87 |
| 112 _RE_RENDERER_VALUES = re.compile('memory_.+_renderer') | 88 _RE_RENDERER_VALUES = re.compile('memory_.+_renderer') |
| 113 | 89 |
| 114 page_set = page_sets.BlinkMemoryMobilePageSet | 90 page_set = page_sets.BlinkMemoryMobilePageSet |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 memory_timeline.MemoryTimelineMetric(), | 147 memory_timeline.MemoryTimelineMetric(), |
| 172 )) | 148 )) |
| 173 | 149 |
| 174 @classmethod | 150 @classmethod |
| 175 def Name(cls): | 151 def Name(cls): |
| 176 return 'memory.long_running_idle_gmail_tbm' | 152 return 'memory.long_running_idle_gmail_tbm' |
| 177 | 153 |
| 178 @classmethod | 154 @classmethod |
| 179 def ShouldTearDownStateAfterEachStoryRun(cls): | 155 def ShouldTearDownStateAfterEachStoryRun(cls): |
| 180 return True | 156 return True |
| OLD | NEW |