Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 def Name(cls): | 49 def Name(cls): |
| 50 return 'system_health.memory_%s' % cls.PLATFORM | 50 return 'system_health.memory_%s' % cls.PLATFORM |
| 51 | 51 |
| 52 @classmethod | 52 @classmethod |
| 53 def ValueCanBeAddedPredicate(cls, value, is_first_result): | 53 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 54 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard | 54 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard |
| 55 # is able to cope with the data load generated by TBMv2 metrics. | 55 # is able to cope with the data load generated by TBMv2 metrics. |
| 56 return not _IGNORED_STATS_RE.search(value.name) | 56 return not _IGNORED_STATS_RE.search(value.name) |
| 57 | 57 |
| 58 | 58 |
| 59 class _PowerSystemHealthBenchmark(perf_benchmark.PerfBenchmark): | |
|
petrcermak
2016/08/12 09:03:00
Instead of interleaving the classes:
_MemorySyste
charliea (OOO until 10-5)
2016/08/12 14:18:43
Done.
| |
| 60 """Chrome Power System Health Benchmark. | |
| 61 | |
| 62 https://goo.gl/Jek2NL. | |
| 63 """ | |
| 64 | |
| 65 def CreateTimelineBasedMeasurementOptions(self): | |
| 66 options = timeline_based_measurement.Options() | |
| 67 options.config.enable_battor_trace = True | |
| 68 options.config.enable_chrome_trace = True | |
| 69 options.config.chrome_trace_config.SetDefaultOverheadFilter() | |
| 70 options.SetTimelineBasedMetrics(['powerMetric', 'clockSyncLatencyMetric']) | |
| 71 return options | |
| 72 | |
| 73 def CreateStorySet(self, options): | |
| 74 return page_sets.SystemHealthStorySet(platform=self.PLATFORM) | |
| 75 | |
| 76 @classmethod | |
| 77 def ShouldTearDownStateAfterEachStoryRun(cls): | |
| 78 return True | |
| 79 | |
| 80 @classmethod | |
| 81 def Name(cls): | |
| 82 return 'system_health.power_%s' % cls.PLATFORM | |
| 83 | |
| 84 @classmethod | |
| 85 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 86 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard | |
| 87 # is able to cope with the data load generated by TBMv2 metrics. | |
| 88 return not _IGNORED_STATS_RE.search(value.name) | |
|
petrcermak
2016/08/12 09:03:00
How many values does your metric generate? If it's
charliea (OOO until 10-5)
2016/08/12 14:18:43
Done.
| |
| 89 | |
| 90 | |
| 59 class DesktopMemorySystemHealth(_MemorySystemHealthBenchmark): | 91 class DesktopMemorySystemHealth(_MemorySystemHealthBenchmark): |
| 60 """Desktop Chrome Memory System Health Benchmark.""" | 92 """Desktop Chrome Memory System Health Benchmark.""" |
| 61 PLATFORM = 'desktop' | 93 PLATFORM = 'desktop' |
| 62 | 94 |
| 63 @classmethod | 95 @classmethod |
| 64 def ShouldDisable(cls, possible_browser): | 96 def ShouldDisable(cls, possible_browser): |
| 65 # http://crbug.com/624355 (reference builds). | 97 # http://crbug.com/624355 (reference builds). |
| 66 return (possible_browser.platform.GetDeviceTypeName() != 'Desktop' or | 98 return (possible_browser.platform.GetDeviceTypeName() != 'Desktop' or |
| 67 possible_browser.browser_type == 'reference') | 99 possible_browser.browser_type == 'reference') |
| 68 | 100 |
| 69 | 101 |
| 70 class MobileMemorySystemHealth(_MemorySystemHealthBenchmark): | 102 class MobileMemorySystemHealth(_MemorySystemHealthBenchmark): |
| 71 """Mobile Chrome Memory System Health Benchmark.""" | 103 """Mobile Chrome Memory System Health Benchmark.""" |
| 72 PLATFORM = 'mobile' | 104 PLATFORM = 'mobile' |
| 73 | 105 |
| 74 @classmethod | 106 @classmethod |
| 75 def ShouldDisable(cls, possible_browser): | 107 def ShouldDisable(cls, possible_browser): |
| 76 # http://crbug.com/612144 | 108 # http://crbug.com/612144 |
| 77 if (possible_browser.browser_type == 'reference' and | 109 if (possible_browser.browser_type == 'reference' and |
| 78 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X'): | 110 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X'): |
| 79 return True | 111 return True |
| 80 | 112 |
| 81 return possible_browser.platform.GetDeviceTypeName() == 'Desktop' | 113 return possible_browser.platform.GetDeviceTypeName() == 'Desktop' |
| 82 | 114 |
| 83 | 115 |
| 116 class DesktopPowerSystemHealth(_PowerSystemHealthBenchmark): | |
| 117 """Desktop Chrome Energy System Health Benchmark.""" | |
| 118 PLATFORM = 'desktop' | |
| 119 | |
| 120 @classmethod | |
| 121 def ShouldDisable(cls, possible_browser): | |
| 122 # http://crbug.com/624355 (reference builds). | |
| 123 return (possible_browser.platform.GetDeviceTypeName() != 'Desktop' or | |
| 124 possible_browser.browser_type == 'reference' or | |
| 125 not possible_browser.platform.HasBattOrConnected()) | |
| 126 | |
| 127 | |
| 128 class MobilePowerSystemHealth(_PowerSystemHealthBenchmark): | |
| 129 """Mobile Chrome Energy System Health Benchmark.""" | |
| 130 PLATFORM = 'mobile' | |
| 131 | |
| 132 @classmethod | |
| 133 def ShouldDisable(cls, possible_browser): | |
| 134 # http://crbug.com/612144 | |
| 135 if (possible_browser.browser_type == 'reference' and | |
| 136 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X'): | |
| 137 return True | |
| 138 | |
| 139 return (possible_browser.platform.GetDeviceTypeName() == 'Desktop' or | |
| 140 not possible_browser.platform.HasBattOrConnected()) | |
| 141 | |
| 142 | |
| 84 @benchmark.Enabled('android-webview') | 143 @benchmark.Enabled('android-webview') |
| 85 class WebviewStartupSystemHealthBenchmark(perf_benchmark.PerfBenchmark): | 144 class WebviewStartupSystemHealthBenchmark(perf_benchmark.PerfBenchmark): |
| 86 """Webview startup time benchmark | 145 """Webview startup time benchmark |
| 87 | 146 |
| 88 Benchmark that measures how long WebView takes to start up | 147 Benchmark that measures how long WebView takes to start up |
| 89 and load a blank page. Since thie metric only requires the trace | 148 and load a blank page. Since thie metric only requires the trace |
| 90 markers recorded in atrace, Chrome tracing is not enabled for this | 149 markers recorded in atrace, Chrome tracing is not enabled for this |
| 91 benchmark. | 150 benchmark. |
| 92 """ | 151 """ |
| 93 page_set = page_sets.BlankPageSet | 152 page_set = page_sets.BlankPageSet |
| 94 | 153 |
| 95 def CreateTimelineBasedMeasurementOptions(self): | 154 def CreateTimelineBasedMeasurementOptions(self): |
| 96 options = timeline_based_measurement.Options() | 155 options = timeline_based_measurement.Options() |
| 97 options.SetTimelineBasedMetrics(['webviewStartupMetric']) | 156 options.SetTimelineBasedMetrics(['webviewStartupMetric']) |
| 98 options.config.enable_atrace_trace = True | 157 options.config.enable_atrace_trace = True |
| 99 options.config.enable_chrome_trace = False | 158 options.config.enable_chrome_trace = False |
| 100 options.config.atrace_config.app_name = 'org.chromium.webview_shell' | 159 options.config.atrace_config.app_name = 'org.chromium.webview_shell' |
| 101 return options | 160 return options |
| 102 | 161 |
| 103 @classmethod | 162 @classmethod |
| 104 def ShouldTearDownStateAfterEachStoryRun(cls): | 163 def ShouldTearDownStateAfterEachStoryRun(cls): |
| 105 return True | 164 return True |
| 106 | 165 |
| 107 @classmethod | 166 @classmethod |
| 108 def Name(cls): | 167 def Name(cls): |
| 109 return 'system_health.webview_startup' | 168 return 'system_health.webview_startup' |
| OLD | NEW |