| 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 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 ]) | 71 ]) |
| 72 | 72 |
| 73 def CreateTimelineBasedMeasurementOptions(self): | 73 def CreateTimelineBasedMeasurementOptions(self): |
| 74 options = timeline_based_measurement.Options( | 74 options = timeline_based_measurement.Options( |
| 75 chrome_trace_category_filter.ChromeTraceCategoryFilter( | 75 chrome_trace_category_filter.ChromeTraceCategoryFilter( |
| 76 '-*,disabled-by-default-memory-infra')) | 76 '-*,disabled-by-default-memory-infra')) |
| 77 options.config.enable_android_graphics_memtrack = True | 77 options.config.enable_android_graphics_memtrack = True |
| 78 options.SetTimelineBasedMetrics(['memoryMetric']) | 78 options.SetTimelineBasedMetrics(['memoryMetric']) |
| 79 return options | 79 return options |
| 80 | 80 |
| 81 def CreateStorySet(self, options): |
| 82 return page_sets.SystemHealthStorySet(platform=self.PLATFORM, case='load', |
| 83 take_memory_measurement=True) |
| 84 |
| 81 @classmethod | 85 @classmethod |
| 82 def Name(cls): | 86 def Name(cls): |
| 83 return 'system_health.memory_%s' % cls.page_set.PLATFORM | 87 return 'system_health.memory_%s' % cls.PLATFORM |
| 84 | 88 |
| 85 @classmethod | 89 @classmethod |
| 86 def ValueCanBeAddedPredicate(cls, value, is_first_result): | 90 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 87 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard | 91 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard |
| 88 # is able to cope with the data load generated by TBMv2 metrics. | 92 # is able to cope with the data load generated by TBMv2 metrics. |
| 89 return not _IGNORED_STATS_RE.search(value.name) | 93 return not _IGNORED_STATS_RE.search(value.name) |
| 90 | 94 |
| 91 | 95 |
| 92 class DesktopMemorySystemHealth(_MemorySystemHealthBenchmark): | 96 class DesktopMemorySystemHealth(_MemorySystemHealthBenchmark): |
| 93 """Desktop Chrome Memory System Health Benchmark.""" | 97 """Desktop Chrome Memory System Health Benchmark.""" |
| 94 page_set = page_sets.DesktopSystemHealthStorySet | 98 PLATFORM = 'desktop' |
| 95 | 99 |
| 96 @classmethod | 100 @classmethod |
| 97 def ShouldDisable(cls, possible_browser): | 101 def ShouldDisable(cls, possible_browser): |
| 98 # http://crbug.com/624355 (reference builds). | 102 # http://crbug.com/624355 (reference builds). |
| 99 return (possible_browser.platform.GetDeviceTypeName() != 'Desktop' or | 103 return (possible_browser.platform.GetDeviceTypeName() != 'Desktop' or |
| 100 possible_browser.browser_type == 'reference') | 104 possible_browser.browser_type == 'reference') |
| 101 | 105 |
| 102 | 106 |
| 103 class MobileMemorySystemHealth(_MemorySystemHealthBenchmark): | 107 class MobileMemorySystemHealth(_MemorySystemHealthBenchmark): |
| 104 """Mobile Chrome Memory System Health Benchmark.""" | 108 """Mobile Chrome Memory System Health Benchmark.""" |
| 105 page_set = page_sets.MobileSystemHealthStorySet | 109 PLATFORM = 'mobile' |
| 106 | 110 |
| 107 @classmethod | 111 @classmethod |
| 108 def ShouldDisable(cls, possible_browser): | 112 def ShouldDisable(cls, possible_browser): |
| 109 # http://crbug.com/612144 (reference on Nexus 5X). | 113 # http://crbug.com/612144 (reference on Nexus 5X). |
| 110 return possible_browser.platform.GetDeviceTypeName() == 'Desktop' or ( | 114 return possible_browser.platform.GetDeviceTypeName() == 'Desktop' or ( |
| 111 possible_browser.browser_type == 'reference' and | 115 possible_browser.browser_type == 'reference' and |
| 112 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X') | 116 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X') |
| 113 | 117 |
| 118 |
| 114 @benchmark.Enabled('android-webview') | 119 @benchmark.Enabled('android-webview') |
| 115 class WebviewStartupSystemHealthBenchmark(perf_benchmark.PerfBenchmark): | 120 class WebviewStartupSystemHealthBenchmark(perf_benchmark.PerfBenchmark): |
| 116 """Webview startup time benchmark | 121 """Webview startup time benchmark |
| 117 | 122 |
| 118 Benchmark that measures how long WebView takes to start up | 123 Benchmark that measures how long WebView takes to start up |
| 119 and load a blank page. Since thie metric only requires the trace | 124 and load a blank page. Since thie metric only requires the trace |
| 120 markers recorded in atrace, Chrome tracing is not enabled for this | 125 markers recorded in atrace, Chrome tracing is not enabled for this |
| 121 benchmark. | 126 benchmark. |
| 122 """ | 127 """ |
| 123 page_set = page_sets.BlankPageSet | 128 page_set = page_sets.BlankPageSet |
| 124 | 129 |
| 125 def CreateTimelineBasedMeasurementOptions(self): | 130 def CreateTimelineBasedMeasurementOptions(self): |
| 126 options = timeline_based_measurement.Options() | 131 options = timeline_based_measurement.Options() |
| 127 options.SetTimelineBasedMetrics(['webviewStartupMetric']) | 132 options.SetTimelineBasedMetrics(['webviewStartupMetric']) |
| 128 options.config.enable_atrace_trace = True | 133 options.config.enable_atrace_trace = True |
| 129 options.config.enable_chrome_trace = False | 134 options.config.enable_chrome_trace = False |
| 130 options.config.atrace_config.app_name = 'org.chromium.webview_shell' | 135 options.config.atrace_config.app_name = 'org.chromium.webview_shell' |
| 131 return options | 136 return options |
| 132 | 137 |
| 133 @classmethod | 138 @classmethod |
| 134 def ShouldTearDownStateAfterEachStoryRun(cls): | 139 def ShouldTearDownStateAfterEachStoryRun(cls): |
| 135 return True | 140 return True |
| 136 | 141 |
| 137 @classmethod | 142 @classmethod |
| 138 def Name(cls): | 143 def Name(cls): |
| 139 return 'system_health.webview_startup' | 144 return 'system_health.webview_startup' |
| OLD | NEW |