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 os |
| 6 |
5 from core import perf_benchmark | 7 from core import perf_benchmark |
6 from telemetry.web_perf import timeline_based_measurement | 8 from telemetry.web_perf import timeline_based_measurement |
7 import page_sets | 9 import page_sets |
8 from telemetry import benchmark | 10 from telemetry import benchmark |
9 | 11 |
10 | 12 |
11 # TODO(rnephew): Remove BattOr naming from all benchmarks once the BattOr tests | 13 # TODO(rnephew): Remove BattOr naming from all benchmarks once the BattOr tests |
12 # are the primary means of benchmarking power. | 14 # are the primary means of benchmarking power. |
13 class _BattOrBenchmark(perf_benchmark.PerfBenchmark): | 15 class _BattOrBenchmark(perf_benchmark.PerfBenchmark): |
14 | 16 |
15 def CreateTimelineBasedMeasurementOptions(self): | 17 def CreateTimelineBasedMeasurementOptions(self): |
16 options = timeline_based_measurement.Options() | 18 options = timeline_based_measurement.Options() |
17 options.config.enable_battor_trace = True | 19 options.config.enable_battor_trace = True |
18 options.config.enable_chrome_trace = True | 20 options.config.enable_chrome_trace = True |
19 options.config.chrome_trace_config.SetDefaultOverheadFilter() | 21 options.config.chrome_trace_config.SetDefaultOverheadFilter() |
20 options.SetTimelineBasedMetrics(['powerMetric', 'clockSyncLatencyMetric']) | 22 options.SetTimelineBasedMetrics(['powerMetric', 'clockSyncLatencyMetric']) |
21 return options | 23 return options |
22 | 24 |
23 @classmethod | 25 @classmethod |
24 def ShouldDisable(cls, possible_browser): | 26 def ShouldDisable(cls, possible_browser): |
25 # Only run if BattOr is detected. | 27 # Only run if BattOr is detected. |
26 if not possible_browser.platform.HasBattOrConnected(): | 28 if not possible_browser.platform.HasBattOrConnected(): |
27 return True | 29 return True |
28 | 30 |
29 # Galaxy S5s have problems with running system health metrics. | 31 # Galaxy S5s have problems with running system health metrics. |
30 # http://crbug.com/600463 | 32 # http://crbug.com/600463 |
31 galaxy_s5_type_name = 'SM-G900H' | 33 galaxy_s5_type_name = 'SM-G900H' |
32 return possible_browser.platform.GetDeviceTypeName() == galaxy_s5_type_name | 34 if possible_browser.platform.GetDeviceTypeName() == galaxy_s5_type_name: |
| 35 return True |
| 36 |
| 37 # TODO(charliea): The BattOr agent is failing intermittently on Mac. We |
| 38 # still want it running on the FYI waterfall to track the flakiness, but |
| 39 # want it disabled on the main perf waterfall until we can make things |
| 40 # stable. |
| 41 # http://crbug.com/634188 |
| 42 return (possible_browser.platform.GetOSName() == 'mac' and |
| 43 'BUILDBOT_MASTERNAME' in os.environ and |
| 44 os.environ['BUILDBOT_MASTERNAME'] == 'chromium.perf') |
33 | 45 |
34 @classmethod | 46 @classmethod |
35 def ShouldTearDownStateAfterEachStoryRun(cls): | 47 def ShouldTearDownStateAfterEachStoryRun(cls): |
36 return True | 48 return True |
37 | 49 |
38 | 50 |
39 # android: See battor.android.tough_video_cases below | 51 # android: See battor.android.tough_video_cases below |
40 # win8: crbug.com/531618 | 52 # win8: crbug.com/531618 |
41 # crbug.com/565180: Only include cases that report time_to_play | 53 # crbug.com/565180: Only include cases that report time_to_play |
42 # Taken directly from media benchmark. | 54 # Taken directly from media benchmark. |
43 @benchmark.Disabled('android', 'win8') | 55 @benchmark.Disabled('android', 'win8') |
44 class BattOrToughVideoCases(_BattOrBenchmark): | 56 class BattOrToughVideoCases(_BattOrBenchmark): |
45 """Obtains media metrics for key user scenarios.""" | 57 """Obtains media metrics for key user scenarios.""" |
46 page_set = page_sets.ToughVideoCasesPageSet | 58 page_set = page_sets.ToughVideoCasesPageSet |
47 | 59 |
48 @classmethod | 60 @classmethod |
49 def Name(cls): | 61 def Name(cls): |
50 return 'battor.tough_video_cases' | 62 return 'battor.tough_video_cases' |
51 | 63 |
52 | 64 |
53 # TODO(rnephew): Add a version that scrolls. | 65 # TODO(rnephew): Add a version that scrolls. |
54 class BattOrSystemHealthLoadingDesktop(_BattOrBenchmark): | 66 class BattOrSystemHealthLoadingDesktop(_BattOrBenchmark): |
55 """Desktop Chrome Memory System Health Benchmark.""" | 67 """Desktop Chrome Memory System Health Benchmark.""" |
56 | 68 |
57 def CreateStorySet(self, options): | 69 def CreateStorySet(self, options): |
58 return page_sets.SystemHealthStorySet(platform='desktop', case='load') | 70 return page_sets.SystemHealthStorySet(platform='desktop', case='load') |
59 | 71 |
60 @classmethod | 72 @classmethod |
61 def ShouldDisable(cls, possible_browser): | 73 def ShouldDisable(cls, possible_browser): |
62 return (possible_browser.platform.GetDeviceTypeName() != 'Desktop' or | 74 return ( |
63 not possible_browser.platform.HasBattOrConnected()) | 75 super(BattOrSystemHealthLoadingDesktop, cls).ShouldDisable( |
| 76 possible_browser) or |
| 77 possible_browser.platform.GetDeviceTypeName() != 'Desktop') |
64 | 78 |
65 @classmethod | 79 @classmethod |
66 def Name(cls): | 80 def Name(cls): |
67 return 'battor.system_health_loading_desktop' | 81 return 'battor.system_health_loading_desktop' |
68 | 82 |
69 | 83 |
70 class BattOrSystemHealthLoadingMobile(_BattOrBenchmark): | 84 class BattOrSystemHealthLoadingMobile(_BattOrBenchmark): |
71 """Mobile Chrome Memory System Health Benchmark.""" | 85 """Mobile Chrome Memory System Health Benchmark.""" |
72 | 86 |
73 def CreateStorySet(self, options): | 87 def CreateStorySet(self, options): |
74 return page_sets.SystemHealthStorySet(platform='mobile', case='load') | 88 return page_sets.SystemHealthStorySet(platform='mobile', case='load') |
75 | 89 |
76 @classmethod | 90 @classmethod |
77 def ShouldDisable(cls, possible_browser): | 91 def ShouldDisable(cls, possible_browser): |
78 if possible_browser.platform.GetDeviceTypeName() == 'Desktop': | 92 if possible_browser.platform.GetDeviceTypeName() == 'Desktop': |
79 return True | 93 return True |
80 if (possible_browser.browser_type == 'reference' and | 94 if (possible_browser.browser_type == 'reference' and |
81 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X'): | 95 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X'): |
82 return True | 96 return True |
83 return not possible_browser.platform.HasBattOrConnected() | 97 |
| 98 return super(BattOrSystemHealthLoadingMobile, cls).ShouldDisable( |
| 99 possible_browser) |
84 | 100 |
85 @classmethod | 101 @classmethod |
86 def Name(cls): | 102 def Name(cls): |
87 return 'battor.system_health_loading_mobile' | 103 return 'battor.system_health_loading_mobile' |
88 | 104 |
89 | 105 |
90 class BattOrPowerCases(_BattOrBenchmark): | 106 class BattOrPowerCases(_BattOrBenchmark): |
91 page_set = page_sets.power_cases.PowerCasesPageSet | 107 page_set = page_sets.power_cases.PowerCasesPageSet |
92 | 108 |
93 @classmethod | 109 @classmethod |
94 def Name(cls): | 110 def Name(cls): |
95 return 'battor.power_cases' | 111 return 'battor.power_cases' |
96 | 112 |
97 | 113 |
98 class BattOrPowerCasesNoChromeTrace(_BattOrBenchmark): | 114 class BattOrPowerCasesNoChromeTrace(_BattOrBenchmark): |
99 page_set = page_sets.power_cases.PowerCasesPageSet | 115 page_set = page_sets.power_cases.PowerCasesPageSet |
100 | 116 |
101 def CreateTimelineBasedMeasurementOptions(self): | 117 def CreateTimelineBasedMeasurementOptions(self): |
102 options = timeline_based_measurement.Options() | 118 options = timeline_based_measurement.Options() |
103 options.config.enable_battor_trace = True | 119 options.config.enable_battor_trace = True |
104 options.config.enable_chrome_trace = False | 120 options.config.enable_chrome_trace = False |
105 options.config.chrome_trace_config.SetDefaultOverheadFilter() | 121 options.config.chrome_trace_config.SetDefaultOverheadFilter() |
106 options.SetTimelineBasedMetrics(['powerMetric', 'clockSyncLatencyMetric']) | 122 options.SetTimelineBasedMetrics(['powerMetric', 'clockSyncLatencyMetric']) |
107 return options | 123 return options |
108 | 124 |
109 @classmethod | 125 @classmethod |
110 def Name(cls): | 126 def Name(cls): |
111 return 'battor.power_cases_no_chrome_trace' | 127 return 'battor.power_cases_no_chrome_trace' |
OLD | NEW |