Chromium Code Reviews| 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. | |
|
Primiano Tucci (use gerrit)
2016/04/25 15:31:03
Should this say: TMBv1 instead of TBMv2 (IIUC True
petrcermak
2016/04/25 15:59:47
I changed this to be an integer argument to make i
| |
| 26 USE_LEGACY_TBM = True | |
| 27 | |
| 25 def SetExtraBrowserOptions(self, options): | 28 def SetExtraBrowserOptions(self, options): |
| 26 options.AppendExtraBrowserArgs([ | 29 options.AppendExtraBrowserArgs([ |
| 27 # TODO(perezju): Temporary workaround to disable periodic memory dumps. | 30 # TODO(perezju): Temporary workaround to disable periodic memory dumps. |
| 28 # See: http://crbug.com/513692 | 31 # See: http://crbug.com/513692 |
| 29 '--enable-memory-benchmarking', | 32 '--enable-memory-benchmarking', |
| 30 ]) | 33 ]) |
| 31 | 34 |
| 32 def CreateTimelineBasedMeasurementOptions(self): | 35 def CreateTimelineBasedMeasurementOptions(self): |
| 33 # Enable only memory-infra, to get memory dumps, and blink.console, to get | 36 # Enable only memory-infra, to get memory dumps, and blink.console, to get |
| 34 # the timeline markers used for mapping threads to tabs. | 37 # the timeline markers used for mapping threads to tabs. |
| 35 trace_memory = tracing_category_filter.TracingCategoryFilter( | 38 trace_memory = tracing_category_filter.TracingCategoryFilter( |
| 36 filter_string='-*,blink.console,disabled-by-default-memory-infra') | 39 filter_string='-*,blink.console,disabled-by-default-memory-infra') |
| 37 tbm_options = timeline_based_measurement.Options( | 40 tbm_options = timeline_based_measurement.Options( |
| 38 overhead_level=trace_memory) | 41 overhead_level=trace_memory) |
| 39 tbm_options.config.enable_android_graphics_memtrack = True | 42 tbm_options.config.enable_android_graphics_memtrack = True |
| 43 if self.USE_LEGACY_TBM: | |
| 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 else: | |
| 50 # TBMv2 (see tracing/tracing/metrics/system_health/memory_metric.html | |
| 51 # in third_party/catapult). | |
| 52 tbm_options.SetTimelineBasedMetric('memoryMetric') | |
| 40 return tbm_options | 53 return tbm_options |
| 41 | 54 |
| 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 | |
| 51 | 55 |
| 52 # TODO(bashi): Workaround for http://crbug.com/532075 | 56 # TODO(bashi): Workaround for http://crbug.com/532075 |
| 53 # @benchmark.Enabled('android') shouldn't be needed. | 57 # @benchmark.Enabled('android') shouldn't be needed. |
| 54 @benchmark.Enabled('android') | 58 @benchmark.Enabled('android') |
| 55 class MemoryHealthQuick(_MemoryInfra): | 59 class MemoryHealthQuick(_MemoryInfra): |
| 56 """Timeline based benchmark for the Memory Health Plan (1 iteration).""" | 60 """Timeline based benchmark for the Memory Health Plan (1 iteration).""" |
| 57 page_set = page_sets.MemoryHealthStory | 61 page_set = page_sets.MemoryHealthStory |
| 58 | 62 |
| 59 @classmethod | 63 @classmethod |
| 60 def Name(cls): | 64 def Name(cls): |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 71 @benchmark.Disabled('all') | 75 @benchmark.Disabled('all') |
| 72 class MemoryHealthPlan(MemoryHealthQuick): | 76 class MemoryHealthPlan(MemoryHealthQuick): |
| 73 """Timeline based benchmark for the Memory Health Plan (5 iterations).""" | 77 """Timeline based benchmark for the Memory Health Plan (5 iterations).""" |
| 74 options = {'pageset_repeat': 5} | 78 options = {'pageset_repeat': 5} |
| 75 | 79 |
| 76 @classmethod | 80 @classmethod |
| 77 def Name(cls): | 81 def Name(cls): |
| 78 return 'memory.memory_health_plan' | 82 return 'memory.memory_health_plan' |
| 79 | 83 |
| 80 | 84 |
| 85 #@benchmark.Enabled('android') | |
| 86 class TBMv2MemoryHealthQuick(MemoryHealthQuick): | |
| 87 """Timeline based benchmark for the Memory Health Plan based on TBMv2. | |
| 88 | |
| 89 This is a temporary benchmark to compare the new TBMv2 memory metric | |
| 90 (memory_metric.html) with the existing TBMv1 one (memory_timeline.py). Once | |
| 91 all issues associated with the TBMv2 metric are resolved, all memory | |
| 92 benchmarks (including the ones in this file) will switch to use it instead | |
| 93 of the TBMv1 metric and this temporary benchmark will be removed. | |
| 94 """ | |
| 95 USE_LEGACY_TBM = False | |
| 96 | |
| 97 @classmethod | |
| 98 def Name(cls): | |
| 99 return super(cls, TBMv2MemoryHealthQuick).Name() + '_tbmv2' | |
| 100 | |
| 101 | |
| 81 # TODO(bashi): Workaround for http://crbug.com/532075 | 102 # TODO(bashi): Workaround for http://crbug.com/532075 |
| 82 # @benchmark.Enabled('android') shouldn't be needed. | 103 # @benchmark.Enabled('android') shouldn't be needed. |
| 83 @benchmark.Enabled('android') | 104 @benchmark.Enabled('android') |
| 84 class RendererMemoryBlinkMemoryMobile(_MemoryInfra): | 105 class RendererMemoryBlinkMemoryMobile(_MemoryInfra): |
| 85 """Timeline based benchmark for measuring memory consumption on mobile | 106 """Timeline based benchmark for measuring memory consumption on mobile |
| 86 sites on which blink's memory consumption is relatively high.""" | 107 sites on which blink's memory consumption is relatively high.""" |
| 87 | 108 |
| 88 _RE_RENDERER_VALUES = re.compile('memory_.+_renderer') | 109 _RE_RENDERER_VALUES = re.compile('memory_.+_renderer') |
| 89 | 110 |
| 90 page_set = page_sets.BlinkMemoryMobilePageSet | 111 page_set = page_sets.BlinkMemoryMobilePageSet |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 memory_timeline.MemoryTimelineMetric(), | 168 memory_timeline.MemoryTimelineMetric(), |
| 148 )) | 169 )) |
| 149 | 170 |
| 150 @classmethod | 171 @classmethod |
| 151 def Name(cls): | 172 def Name(cls): |
| 152 return 'memory.long_running_idle_gmail_tbm' | 173 return 'memory.long_running_idle_gmail_tbm' |
| 153 | 174 |
| 154 @classmethod | 175 @classmethod |
| 155 def ShouldTearDownStateAfterEachStoryRun(cls): | 176 def ShouldTearDownStateAfterEachStoryRun(cls): |
| 156 return True | 177 return True |
| OLD | NEW |