| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 from core import perf_benchmark | 5 from core import perf_benchmark |
| 6 | 6 |
| 7 from benchmarks import silk_flags | 7 from benchmarks import silk_flags |
| 8 from measurements import power | 8 from measurements import power |
| 9 import page_sets | 9 import page_sets |
| 10 from telemetry import benchmark | 10 from telemetry import benchmark |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 page_set = page_sets.Top25PageSet | 140 page_set = page_sets.Top25PageSet |
| 141 | 141 |
| 142 def SetExtraBrowserOptions(self, options): | 142 def SetExtraBrowserOptions(self, options): |
| 143 options.full_performance_mode = False | 143 options.full_performance_mode = False |
| 144 | 144 |
| 145 @classmethod | 145 @classmethod |
| 146 def Name(cls): | 146 def Name(cls): |
| 147 return 'power.top_25' | 147 return 'power.top_25' |
| 148 | 148 |
| 149 def CreateStorySet(self, _): | 149 def CreateStorySet(self, _): |
| 150 # Exclude techcrunch.com. It is not suitable for this benchmark because it | |
| 151 # does not consistently become quiescent within 60 seconds. | |
| 152 stories = self.page_set() | 150 stories = self.page_set() |
| 153 found = next((x for x in stories if 'techcrunch.com' in x.url), None) | 151 to_remove = [x for x in stories if self.IsPageNotQuiescent(x.url)] |
| 154 if found: | 152 for story in to_remove: |
| 155 stories.RemoveStory(found) | 153 stories.RemoveStory(story) |
| 156 return stories | 154 return stories |
| 157 | 155 |
| 156 @staticmethod |
| 157 def IsPageNotQuiescent(page_url): |
| 158 # Exclude sites not suitable for this benchmark because they do not |
| 159 # consistently become quiescent within 60 seconds. |
| 160 non_quiescent_urls = [ |
| 161 'techcrunch.com', |
| 162 'docs.google.com', |
| 163 'plus.google.com' |
| 164 ] |
| 165 |
| 166 return any(url in page_url for url in non_quiescent_urls) |
| 167 |
| 158 | 168 |
| 159 @benchmark.Enabled('mac') | 169 @benchmark.Enabled('mac') |
| 160 class PowerGpuRasterizationTop25(perf_benchmark.PerfBenchmark): | 170 class PowerGpuRasterizationTop25(PowerTop25): |
| 161 """Top 25 quiescent power test with GPU rasterization enabled.""" | 171 """Top 25 quiescent power test with GPU rasterization enabled.""" |
| 162 tag = 'gpu_rasterization' | 172 tag = 'gpu_rasterization' |
| 163 test = power.QuiescentPower | |
| 164 page_set = page_sets.Top25PageSet | |
| 165 | 173 |
| 166 def SetExtraBrowserOptions(self, options): | 174 def SetExtraBrowserOptions(self, options): |
| 167 silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) | 175 silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) |
| 168 options.full_performance_mode = False | 176 options.full_performance_mode = False |
| 169 | 177 |
| 170 @classmethod | 178 @classmethod |
| 171 def Name(cls): | 179 def Name(cls): |
| 172 return 'power.gpu_rasterization.top_25' | 180 return 'power.gpu_rasterization.top_25' |
| 173 | 181 |
| 174 def CreateStorySet(self, _): | |
| 175 # Exclude techcrunch.com. It is not suitable for this benchmark because it | |
| 176 # does not consistently become quiescent within 60 seconds. | |
| 177 stories = self.page_set() | |
| 178 found = next((x for x in stories if 'techcrunch.com' in x.url), None) | |
| 179 if found: | |
| 180 stories.RemoveStory(found) | |
| 181 return stories | |
| 182 | |
| 183 | 182 |
| 184 @benchmark.Enabled('mac') | 183 @benchmark.Enabled('mac') |
| 185 class PowerScrollingTrivialPage(perf_benchmark.PerfBenchmark): | 184 class PowerScrollingTrivialPage(perf_benchmark.PerfBenchmark): |
| 186 """Measure power consumption for some very simple pages.""" | 185 """Measure power consumption for some very simple pages.""" |
| 187 test = power.QuiescentPower | 186 test = power.QuiescentPower |
| 188 page_set = page_sets.MacGpuTrivialPagesStorySet | 187 page_set = page_sets.MacGpuTrivialPagesStorySet |
| 189 | 188 |
| 190 @classmethod | 189 @classmethod |
| 191 def Name(cls): | 190 def Name(cls): |
| 192 return 'power.trivial_pages' | 191 return 'power.trivial_pages' |
| 193 | 192 |
| 194 @benchmark.Enabled('mac') | 193 @benchmark.Enabled('mac') |
| 195 class PowerSteadyStatePages(perf_benchmark.PerfBenchmark): | 194 class PowerSteadyStatePages(perf_benchmark.PerfBenchmark): |
| 196 """Measure power consumption for real web sites in steady state (no user | 195 """Measure power consumption for real web sites in steady state (no user |
| 197 interactions).""" | 196 interactions).""" |
| 198 test = power.QuiescentPower | 197 test = power.QuiescentPower |
| 199 page_set = page_sets.IdleAfterLoadingStories | 198 page_set = page_sets.IdleAfterLoadingStories |
| 200 | 199 |
| 201 @classmethod | 200 @classmethod |
| 202 def Name(cls): | 201 def Name(cls): |
| 203 return 'power.steady_state' | 202 return 'power.steady_state' |
| OLD | NEW |