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