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 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 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 def SetExtraBrowserOptions(self, options): | 25 def SetExtraBrowserOptions(self, options): |
| 26 options.AppendExtraBrowserArgs([ | 26 options.AppendExtraBrowserArgs([ |
| 27 # TODO(perezju): Temporary workaround to disable periodic memory dumps. | 27 # TODO(perezju): Temporary workaround to disable periodic memory dumps. |
| 28 # See: http://crbug.com/513692 | 28 # See: http://crbug.com/513692 |
| 29 '--enable-memory-benchmarking', | 29 '--enable-memory-benchmarking', |
| 30 ]) | 30 ]) |
| 31 | 31 |
| 32 | |
| 33 class _TBMv1MemoryInfra(_MemoryInfra): | |
|
perezju
2016/04/25 09:03:49
As per the discussion in https://github.com/catapu
petrcermak
2016/04/25 10:00:35
Done.
perezju
2016/04/25 11:24:00
Awesome! Looks much better.
| |
| 34 """Base class for memory benchmarks based on TBMv1 memory-infra. | |
| 35 | |
| 36 See | |
| 37 third_party/catapult/telemetry/telemetry/web_perf/metrics/memory_timeline.py | |
| 38 for more details about the Timeline Based Measurement v1 memory metric. | |
| 39 """ | |
| 40 | |
| 32 def CreateTimelineBasedMeasurementOptions(self): | 41 def CreateTimelineBasedMeasurementOptions(self): |
| 33 # Enable only memory-infra, to get memory dumps, and blink.console, to get | 42 # Enable only memory-infra, to get memory dumps, and blink.console, to get |
| 34 # the timeline markers used for mapping threads to tabs. | 43 # the timeline markers used for mapping threads to tabs. |
| 35 trace_memory = tracing_category_filter.TracingCategoryFilter( | 44 trace_memory = tracing_category_filter.TracingCategoryFilter( |
| 36 filter_string='-*,blink.console,disabled-by-default-memory-infra') | 45 filter_string='-*,blink.console,disabled-by-default-memory-infra') |
| 37 tbm_options = timeline_based_measurement.Options( | 46 tbm_options = timeline_based_measurement.Options( |
| 38 overhead_level=trace_memory) | 47 overhead_level=trace_memory) |
| 39 tbm_options.config.enable_android_graphics_memtrack = True | 48 tbm_options.config.enable_android_graphics_memtrack = True |
| 40 return tbm_options | 49 return tbm_options |
| 41 | 50 |
| 42 @classmethod | 51 @classmethod |
| 43 def HasTraceRerunDebugOption(cls): | 52 def HasTraceRerunDebugOption(cls): |
| 44 return True | 53 return True |
| 45 | 54 |
| 46 def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): | 55 def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): |
| 47 tbm_options.SetLegacyTimelineBasedMetrics(( | 56 tbm_options.SetLegacyTimelineBasedMetrics(( |
| 48 memory_timeline.MemoryTimelineMetric(), | 57 memory_timeline.MemoryTimelineMetric(), |
| 49 )) | 58 )) |
| 50 | 59 |
| 51 | 60 |
| 61 class _TBMv2MemoryInfra(_MemoryInfra): | |
| 62 """Base class for memory benchmarks based on TBMv2 memory-infra. | |
| 63 | |
| 64 See | |
| 65 third_party/catapult/tracing/tracing/metrics/system_health/memory_metric.html | |
| 66 for more details about the Timeline Based Measurement v2 memory metric. | |
| 67 """ | |
| 68 | |
| 69 def CreateTimelineBasedMeasurementOptions(self): | |
| 70 tbm_options = super( | |
| 71 _TBMv2MemoryInfra, self).CreateTimelineBasedMeasurementOptions() | |
| 72 tbm_options.SetTimelineBasedMetric('memoryMetric') | |
| 73 return tbm_options | |
| 74 | |
| 75 | |
| 52 # TODO(bashi): Workaround for http://crbug.com/532075 | 76 # TODO(bashi): Workaround for http://crbug.com/532075 |
| 53 # @benchmark.Enabled('android') shouldn't be needed. | 77 # @benchmark.Enabled('android') shouldn't be needed. |
| 54 @benchmark.Enabled('android') | 78 @benchmark.Enabled('android') |
| 55 class MemoryHealthQuick(_MemoryInfra): | 79 class MemoryHealthQuick(_TBMv1MemoryInfra): |
| 56 """Timeline based benchmark for the Memory Health Plan (1 iteration).""" | 80 """Timeline based benchmark for the Memory Health Plan (1 iteration).""" |
| 57 page_set = page_sets.MemoryHealthStory | 81 page_set = page_sets.MemoryHealthStory |
| 58 | 82 |
| 59 @classmethod | 83 @classmethod |
| 60 def Name(cls): | 84 def Name(cls): |
| 61 return 'memory.memory_health_quick' | 85 return 'memory.memory_health_quick' |
| 62 | 86 |
| 63 @classmethod | 87 @classmethod |
| 64 def ShouldDisable(cls, possible_browser): | 88 def ShouldDisable(cls, possible_browser): |
| 65 # Benchmark requires DeskClock app only available on Nexus devices. | 89 # Benchmark requires DeskClock app only available on Nexus devices. |
| 66 # See http://crbug.com/546842 | 90 # See http://crbug.com/546842 |
| 67 return 'nexus' not in possible_browser.platform.GetDeviceTypeName().lower() | 91 return 'nexus' not in possible_browser.platform.GetDeviceTypeName().lower() |
| 68 | 92 |
| 69 | 93 |
| 70 # Benchmark is disabled by default because it takes too long to run. | 94 # Benchmark is disabled by default because it takes too long to run. |
| 71 @benchmark.Disabled('all') | 95 @benchmark.Disabled('all') |
| 72 class MemoryHealthPlan(MemoryHealthQuick): | 96 class MemoryHealthPlan(MemoryHealthQuick): |
| 73 """Timeline based benchmark for the Memory Health Plan (5 iterations).""" | 97 """Timeline based benchmark for the Memory Health Plan (5 iterations).""" |
| 74 options = {'pageset_repeat': 5} | 98 options = {'pageset_repeat': 5} |
| 75 | 99 |
| 76 @classmethod | 100 @classmethod |
| 77 def Name(cls): | 101 def Name(cls): |
| 78 return 'memory.memory_health_plan' | 102 return 'memory.memory_health_plan' |
| 79 | 103 |
| 80 | 104 |
| 105 @benchmark.Enabled('android') | |
| 106 class TBMv2MemoryHealthQuick(_TBMv2MemoryInfra): | |
| 107 """Timeline based benchmark for the Memory Health Plan based on TBMv2. | |
| 108 | |
| 109 This is a temporary benchmark to compare the new TBMv2 memory metric | |
| 110 (memory_metric.html) with the existing TBMv1 one (memory_timeline.py). Once | |
| 111 all issues associated with the TBMv2 metric are resolved, all memory | |
| 112 benchmarks (including the ones in this file) will switch to use it instead | |
| 113 of the TBMv1 metric and this temporary benchmark will be removed. | |
| 114 """ | |
| 115 page_set = MemoryHealthQuick.page_set | |
| 116 | |
| 117 @classmethod | |
| 118 def Name(cls): | |
| 119 return MemoryHealthQuick.Name() + '_tbmv2' | |
| 120 | |
| 121 @classmethod | |
| 122 def ShouldDisable(cls, possible_browser): | |
| 123 return MemoryHealthQuick.ShouldDisable(possible_browser) | |
| 124 | |
| 125 | |
| 81 # TODO(bashi): Workaround for http://crbug.com/532075 | 126 # TODO(bashi): Workaround for http://crbug.com/532075 |
| 82 # @benchmark.Enabled('android') shouldn't be needed. | 127 # @benchmark.Enabled('android') shouldn't be needed. |
| 83 @benchmark.Enabled('android') | 128 @benchmark.Enabled('android') |
| 84 class RendererMemoryBlinkMemoryMobile(_MemoryInfra): | 129 class RendererMemoryBlinkMemoryMobile(_TBMv1MemoryInfra): |
| 85 """Timeline based benchmark for measuring memory consumption on mobile | 130 """Timeline based benchmark for measuring memory consumption on mobile |
| 86 sites on which blink's memory consumption is relatively high.""" | 131 sites on which blink's memory consumption is relatively high.""" |
| 87 | 132 |
| 88 _RE_RENDERER_VALUES = re.compile('memory_.+_renderer') | 133 _RE_RENDERER_VALUES = re.compile('memory_.+_renderer') |
| 89 | 134 |
| 90 page_set = page_sets.BlinkMemoryMobilePageSet | 135 page_set = page_sets.BlinkMemoryMobilePageSet |
| 91 | 136 |
| 92 def SetExtraBrowserOptions(self, options): | 137 def SetExtraBrowserOptions(self, options): |
| 93 super(RendererMemoryBlinkMemoryMobile, self).SetExtraBrowserOptions( | 138 super(RendererMemoryBlinkMemoryMobile, self).SetExtraBrowserOptions( |
| 94 options) | 139 options) |
| 95 options.AppendExtraBrowserArgs([ | 140 options.AppendExtraBrowserArgs([ |
| 96 # Ignore certs errors because record_wpr cannot handle certs correctly | 141 # Ignore certs errors because record_wpr cannot handle certs correctly |
| 97 # in some cases (e.g. WordPress). | 142 # in some cases (e.g. WordPress). |
| 98 '--ignore-certificate-errors', | 143 '--ignore-certificate-errors', |
| 99 ]) | 144 ]) |
| 100 | 145 |
| 101 @classmethod | 146 @classmethod |
| 102 def Name(cls): | 147 def Name(cls): |
| 103 return 'memory.blink_memory_mobile' | 148 return 'memory.blink_memory_mobile' |
| 104 | 149 |
| 105 @classmethod | 150 @classmethod |
| 106 def ValueCanBeAddedPredicate(cls, value, is_first_result): | 151 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 107 return bool(cls._RE_RENDERER_VALUES.match(value.name)) | 152 return bool(cls._RE_RENDERER_VALUES.match(value.name)) |
| 108 | 153 |
| 109 | 154 |
| 110 # Disabled on reference builds because they don't support the new | 155 # Disabled on reference builds because they don't support the new |
| 111 # Tracing.requestMemoryDump DevTools API. See http://crbug.com/540022. | 156 # Tracing.requestMemoryDump DevTools API. See http://crbug.com/540022. |
| 112 @benchmark.Disabled('reference') | 157 @benchmark.Disabled('reference') |
| 113 class MemoryBenchmarkTop10Mobile(_MemoryInfra): | 158 class MemoryBenchmarkTop10Mobile(_TBMv1MemoryInfra): |
| 114 """Timeline based benchmark for measuring memory on top 10 mobile sites.""" | 159 """Timeline based benchmark for measuring memory on top 10 mobile sites.""" |
| 115 | 160 |
| 116 page_set = page_sets.MemoryInfraTop10MobilePageSet | 161 page_set = page_sets.MemoryInfraTop10MobilePageSet |
| 117 | 162 |
| 118 @classmethod | 163 @classmethod |
| 119 def Name(cls): | 164 def Name(cls): |
| 120 return 'memory.top_10_mobile' | 165 return 'memory.top_10_mobile' |
| 121 | 166 |
| 122 | 167 |
| 123 # Disabled on reference builds because they don't support the new | 168 # Disabled on reference builds because they don't support the new |
| 124 # Tracing.requestMemoryDump DevTools API. | 169 # Tracing.requestMemoryDump DevTools API. |
| 125 # For 'reference' see http://crbug.com/540022. | 170 # For 'reference' see http://crbug.com/540022. |
| 126 # For 'android' see http://crbug.com/579546. | 171 # For 'android' see http://crbug.com/579546. |
| 127 @benchmark.Disabled('reference', 'android') | 172 @benchmark.Disabled('reference', 'android') |
| 128 class MemoryLongRunningIdleGmailTBM(_MemoryInfra): | 173 class MemoryLongRunningIdleGmailTBM(_TBMv1MemoryInfra): |
| 129 """Use (recorded) real world web sites and measure memory consumption | 174 """Use (recorded) real world web sites and measure memory consumption |
| 130 of long running idle Gmail page """ | 175 of long running idle Gmail page """ |
| 131 page_set = page_sets.LongRunningIdleGmailPageSet | 176 page_set = page_sets.LongRunningIdleGmailPageSet |
| 132 | 177 |
| 133 def CreateTimelineBasedMeasurementOptions(self): | 178 def CreateTimelineBasedMeasurementOptions(self): |
| 134 v8_categories = [ | 179 v8_categories = [ |
| 135 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] | 180 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] |
| 136 memory_categories = 'blink.console,disabled-by-default-memory-infra' | 181 memory_categories = 'blink.console,disabled-by-default-memory-infra' |
| 137 category_filter = tracing_category_filter.TracingCategoryFilter( | 182 category_filter = tracing_category_filter.TracingCategoryFilter( |
| 138 memory_categories) | 183 memory_categories) |
| 139 for category in v8_categories: | 184 for category in v8_categories: |
| 140 category_filter.AddIncludedCategory(category) | 185 category_filter.AddIncludedCategory(category) |
| 141 options = timeline_based_measurement.Options(category_filter) | 186 options = timeline_based_measurement.Options(category_filter) |
| 142 return options | 187 return options |
| 143 | 188 |
| 144 def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): | 189 def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options): |
| 145 tbm_options.SetLegacyTimelineBasedMetrics(( | 190 tbm_options.SetLegacyTimelineBasedMetrics(( |
| 146 v8_gc_latency.V8GCLatency(), | 191 v8_gc_latency.V8GCLatency(), |
| 147 memory_timeline.MemoryTimelineMetric(), | 192 memory_timeline.MemoryTimelineMetric(), |
| 148 )) | 193 )) |
| 149 | 194 |
| 150 @classmethod | 195 @classmethod |
| 151 def Name(cls): | 196 def Name(cls): |
| 152 return 'memory.long_running_idle_gmail_tbm' | 197 return 'memory.long_running_idle_gmail_tbm' |
| 153 | 198 |
| 154 @classmethod | 199 @classmethod |
| 155 def ShouldTearDownStateAfterEachStoryRun(cls): | 200 def ShouldTearDownStateAfterEachStoryRun(cls): |
| 156 return True | 201 return True |
| OLD | NEW |