| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 from telemetry import benchmark | 8 from telemetry import benchmark |
| 9 from telemetry.timeline import chrome_trace_category_filter | 9 from telemetry.timeline import chrome_trace_category_filter |
| 10 from telemetry.web_perf import timeline_based_measurement | 10 from telemetry.web_perf import timeline_based_measurement |
| 11 import page_sets | 11 import page_sets |
| 12 | 12 |
| 13 | 13 |
| 14 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames() | 14 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames() |
| 15 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value
/numeric.html#L323 | 15 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value
/numeric.html#L323 |
| 16 _IGNORED_STATS_RE = re.compile(r'_(std|count|max|min|sum|pct_\d{4}(_\d+)?)$') | 16 _IGNORED_STATS_RE = re.compile(r'_(std|count|max|min|sum|pct_\d{4}(_\d+)?)$') |
| 17 | 17 |
| 18 | 18 |
| 19 class _CommonSystemHealthBenchmark(perf_benchmark.PerfBenchmark): |
| 20 """Chrome Common System Health Benchmark. |
| 21 |
| 22 This test suite contains system health benchmarks that can be collected |
| 23 together due to the low overhead of the tracing agents required. If a |
| 24 benchmark does have significant overhead, it should either: |
| 25 |
| 26 1) Be rearchitected such that it doesn't. This is the most preferred option. |
| 27 2) Be run in a separate test suite (e.g. memory). |
| 28 |
| 29 https://goo.gl/Jek2NL. |
| 30 """ |
| 31 |
| 32 def CreateTimelineBasedMeasurementOptions(self): |
| 33 options = timeline_based_measurement.Options( |
| 34 chrome_trace_category_filter.ChromeTraceCategoryFilter()) |
| 35 options.config.chrome_trace_config.category_filter.AddFilterString('rail') |
| 36 options.config.enable_battor_trace = True |
| 37 options.config.enable_chrome_trace = True |
| 38 return options |
| 39 |
| 40 def CreateStorySet(self, options): |
| 41 return page_sets.SystemHealthStorySet(platform=self.PLATFORM) |
| 42 |
| 43 @classmethod |
| 44 def ShouldTearDownStateAfterEachStoryRun(cls): |
| 45 return True |
| 46 |
| 47 @classmethod |
| 48 def Name(cls): |
| 49 return 'system_health.common_%s' % cls.PLATFORM |
| 50 |
| 51 |
| 52 class DesktopCommonSystemHealth(_CommonSystemHealthBenchmark): |
| 53 """Desktop Chrome Energy System Health Benchmark.""" |
| 54 PLATFORM = 'desktop' |
| 55 |
| 56 @classmethod |
| 57 def ShouldDisable(cls, possible_browser): |
| 58 # http://crbug.com/624355 (reference builds). |
| 59 return (possible_browser.platform.GetDeviceTypeName() != 'Desktop' or |
| 60 possible_browser.browser_type == 'reference') |
| 61 |
| 62 |
| 63 class MobileCommonSystemHealth(_CommonSystemHealthBenchmark): |
| 64 """Mobile Chrome Energy System Health Benchmark.""" |
| 65 PLATFORM = 'mobile' |
| 66 |
| 67 @classmethod |
| 68 def ShouldDisable(cls, possible_browser): |
| 69 # http://crbug.com/612144 |
| 70 if (possible_browser.browser_type == 'reference' and |
| 71 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X'): |
| 72 return True |
| 73 |
| 74 return possible_browser.platform.GetDeviceTypeName() == 'Desktop' |
| 75 |
| 76 |
| 19 class _MemorySystemHealthBenchmark(perf_benchmark.PerfBenchmark): | 77 class _MemorySystemHealthBenchmark(perf_benchmark.PerfBenchmark): |
| 20 """Chrome Memory System Health Benchmark. | 78 """Chrome Memory System Health Benchmark. |
| 21 | 79 |
| 80 This test suite is run separately from the common one due to the high overhead |
| 81 of memory tracing. |
| 82 |
| 22 https://goo.gl/Jek2NL. | 83 https://goo.gl/Jek2NL. |
| 23 """ | 84 """ |
| 24 | 85 |
| 25 def SetExtraBrowserOptions(self, options): | 86 def SetExtraBrowserOptions(self, options): |
| 26 options.AppendExtraBrowserArgs([ | 87 options.AppendExtraBrowserArgs([ |
| 27 # TODO(perezju): Temporary workaround to disable periodic memory dumps. | 88 # TODO(perezju): Temporary workaround to disable periodic memory dumps. |
| 28 # See: http://crbug.com/513692 | 89 # See: http://crbug.com/513692 |
| 29 '--enable-memory-benchmarking', | 90 '--enable-memory-benchmarking', |
| 30 ]) | 91 ]) |
| 31 | 92 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 options.config.atrace_config.app_name = 'org.chromium.webview_shell' | 161 options.config.atrace_config.app_name = 'org.chromium.webview_shell' |
| 101 return options | 162 return options |
| 102 | 163 |
| 103 @classmethod | 164 @classmethod |
| 104 def ShouldTearDownStateAfterEachStoryRun(cls): | 165 def ShouldTearDownStateAfterEachStoryRun(cls): |
| 105 return True | 166 return True |
| 106 | 167 |
| 107 @classmethod | 168 @classmethod |
| 108 def Name(cls): | 169 def Name(cls): |
| 109 return 'system_health.webview_startup' | 170 return 'system_health.webview_startup' |
| OLD | NEW |