| 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 chrome_trace_category_filter | 10 from telemetry.timeline import chrome_trace_category_filter |
| 11 from telemetry.timeline import chrome_trace_config | |
| 12 from telemetry.web_perf import timeline_based_measurement | 11 from telemetry.web_perf import timeline_based_measurement |
| 13 | 12 |
| 14 import page_sets | 13 import page_sets |
| 15 | 14 |
| 16 | 15 |
| 17 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames() | 16 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames() |
| 18 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value
/numeric.html#L323 | 17 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value
/numeric.html#L323 |
| 19 _IGNORED_STATS_RE = re.compile( | 18 _IGNORED_STATS_RE = re.compile( |
| 20 r'(?<!dump)(?<!process)_(std|count|max|min|sum|pct_\d{4}(_\d+)?)$') | 19 r'(?<!dump)(?<!process)_(std|count|max|min|sum|pct_\d{4}(_\d+)?)$') |
| 21 | 20 |
| 22 | 21 |
| 23 class _MemoryInfra(perf_benchmark.PerfBenchmark): | 22 class _MemoryInfra(perf_benchmark.PerfBenchmark): |
| 24 """Base class for new-generation memory benchmarks based on memory-infra. | 23 """Base class for new-generation memory benchmarks based on memory-infra. |
| 25 | 24 |
| 26 This benchmark records data using memory-infra (https://goo.gl/8tGc6O), which | 25 This benchmark records data using memory-infra (https://goo.gl/8tGc6O), which |
| 27 is part of chrome tracing, and extracts it using timeline-based measurements. | 26 is part of chrome tracing, and extracts it using timeline-based measurements. |
| 28 """ | 27 """ |
| 29 | 28 |
| 29 def SetExtraBrowserOptions(self, options): |
| 30 options.AppendExtraBrowserArgs([ |
| 31 # TODO(perezju): Temporary workaround to disable periodic memory dumps. |
| 32 # See: http://crbug.com/513692 |
| 33 '--enable-memory-benchmarking', |
| 34 ]) |
| 35 |
| 30 def CreateTimelineBasedMeasurementOptions(self): | 36 def CreateTimelineBasedMeasurementOptions(self): |
| 31 # Enable only memory-infra, to get memory dumps, and blink.console, to get | 37 # Enable only memory-infra, to get memory dumps, and blink.console, to get |
| 32 # the timeline markers used for mapping threads to tabs. | 38 # the timeline markers used for mapping threads to tabs. |
| 33 trace_memory = chrome_trace_category_filter.ChromeTraceCategoryFilter( | 39 trace_memory = chrome_trace_category_filter.ChromeTraceCategoryFilter( |
| 34 filter_string='-*,blink.console,disabled-by-default-memory-infra') | 40 filter_string='-*,blink.console,disabled-by-default-memory-infra') |
| 35 tbm_options = timeline_based_measurement.Options( | 41 tbm_options = timeline_based_measurement.Options( |
| 36 overhead_level=trace_memory) | 42 overhead_level=trace_memory) |
| 37 tbm_options.config.enable_android_graphics_memtrack = True | 43 tbm_options.config.enable_android_graphics_memtrack = True |
| 38 tbm_options.SetTimelineBasedMetrics(['memoryMetric']) | 44 tbm_options.SetTimelineBasedMetrics(['memoryMetric']) |
| 39 # Setting an empty memory dump config disables periodic dumps. | |
| 40 tbm_options.config.chrome_trace_config.SetMemoryDumpConfig( | |
| 41 chrome_trace_config.MemoryDumpConfig()) | |
| 42 return tbm_options | 45 return tbm_options |
| 43 | 46 |
| 44 | 47 |
| 45 # TODO(bashi): Workaround for http://crbug.com/532075. | 48 # TODO(bashi): Workaround for http://crbug.com/532075. |
| 46 # @benchmark.Enabled('android') shouldn't be needed. | 49 # @benchmark.Enabled('android') shouldn't be needed. |
| 47 @benchmark.Enabled('android') | 50 @benchmark.Enabled('android') |
| 48 class MemoryBenchmarkTop10Mobile(_MemoryInfra): | 51 class MemoryBenchmarkTop10Mobile(_MemoryInfra): |
| 49 """Measure foreground/background memory on top 10 mobile page set. | 52 """Measure foreground/background memory on top 10 mobile page set. |
| 50 | 53 |
| 51 This metric provides memory measurements for the System Health Plan of | 54 This metric provides memory measurements for the System Health Plan of |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 r'(reported_by_chrome:v8|reported_by_os:system_memory:[^:]+$)') | 175 r'(reported_by_chrome:v8|reported_by_os:system_memory:[^:]+$)') |
| 173 | 176 |
| 174 def CreateTimelineBasedMeasurementOptions(self): | 177 def CreateTimelineBasedMeasurementOptions(self): |
| 175 v8_categories = [ | 178 v8_categories = [ |
| 176 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] | 179 'blink.console', 'renderer.scheduler', 'v8', 'webkit.console'] |
| 177 memory_categories = ['blink.console', 'disabled-by-default-memory-infra'] | 180 memory_categories = ['blink.console', 'disabled-by-default-memory-infra'] |
| 178 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter( | 181 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter( |
| 179 ','.join(['-*'] + v8_categories + memory_categories)) | 182 ','.join(['-*'] + v8_categories + memory_categories)) |
| 180 options = timeline_based_measurement.Options(category_filter) | 183 options = timeline_based_measurement.Options(category_filter) |
| 181 options.SetTimelineBasedMetrics(['v8AndMemoryMetrics']) | 184 options.SetTimelineBasedMetrics(['v8AndMemoryMetrics']) |
| 182 # Setting an empty memory dump config disables periodic dumps. | |
| 183 options.config.chrome_trace_config.SetMemoryDumpConfig( | |
| 184 chrome_trace_config.MemoryDumpConfig()) | |
| 185 return options | 185 return options |
| 186 | 186 |
| 187 @classmethod | 187 @classmethod |
| 188 def ValueCanBeAddedPredicate(cls, value, _): | 188 def ValueCanBeAddedPredicate(cls, value, _): |
| 189 if 'memory:chrome' in value.name: | 189 if 'memory:chrome' in value.name: |
| 190 # TODO(petrcermak): Remove the first two cases once | 190 # TODO(petrcermak): Remove the first two cases once |
| 191 # https://codereview.chromium.org/2018503002/ lands in Catapult and rolls | 191 # https://codereview.chromium.org/2018503002/ lands in Catapult and rolls |
| 192 # into Chromium. | 192 # into Chromium. |
| 193 return ('renderer:subsystem:v8' in value.name or | 193 return ('renderer:subsystem:v8' in value.name or |
| 194 'renderer:vmstats:overall' in value.name or | 194 'renderer:vmstats:overall' in value.name or |
| (...skipping 21 matching lines...) Expand all Loading... |
| 216 of long running idle Gmail page """ | 216 of long running idle Gmail page """ |
| 217 page_set = page_sets.LongRunningIdleGmailBackgroundPageSet | 217 page_set = page_sets.LongRunningIdleGmailBackgroundPageSet |
| 218 | 218 |
| 219 @classmethod | 219 @classmethod |
| 220 def Name(cls): | 220 def Name(cls): |
| 221 return 'memory.long_running_idle_gmail_background_tbmv2' | 221 return 'memory.long_running_idle_gmail_background_tbmv2' |
| 222 | 222 |
| 223 @classmethod | 223 @classmethod |
| 224 def ShouldDisable(cls, possible_browser): # http://crbug.com/616530 | 224 def ShouldDisable(cls, possible_browser): # http://crbug.com/616530 |
| 225 return cls.IsSvelte(possible_browser) | 225 return cls.IsSvelte(possible_browser) |
| OLD | NEW |