| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 time | 5 import time |
| 6 | 6 |
| 7 from metrics import smoothness | 7 from metrics import smoothness |
| 8 from telemetry.page import page_measurement | 8 from telemetry.page import page_measurement |
| 9 | 9 |
| 10 class StatsCollector(object): | 10 class StatsCollector(object): |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 parser.add_option('--stop-wait-time', dest='stop_wait_time', | 110 parser.add_option('--stop-wait-time', dest='stop_wait_time', |
| 111 default=5, | 111 default=5, |
| 112 help='Wait time before measurement is taken ' + | 112 help='Wait time before measurement is taken ' + |
| 113 '(must be long enough to render one frame)') | 113 '(must be long enough to render one frame)') |
| 114 | 114 |
| 115 def CustomizeBrowserOptions(self, options): | 115 def CustomizeBrowserOptions(self, options): |
| 116 smoothness.SmoothnessMetrics.CustomizeBrowserOptions(options) | 116 smoothness.SmoothnessMetrics.CustomizeBrowserOptions(options) |
| 117 # Run each raster task N times. This allows us to report the time for the | 117 # Run each raster task N times. This allows us to report the time for the |
| 118 # best run, effectively excluding cache effects and time when the thread is | 118 # best run, effectively excluding cache effects and time when the thread is |
| 119 # de-scheduled. | 119 # de-scheduled. |
| 120 options.AppendExtraBrowserArg( | 120 options.AppendExtraBrowserArgs([ |
| 121 '--slow-down-raster-scale-factor=' + str(options.raster_record_repeat)) | 121 '--slow-down-raster-scale-factor=%d' % options.raster_record_repeat, |
| 122 # Enable impl-side-painting. Current version of benchmark only works for | 122 # Enable impl-side-painting. Current version of benchmark only works for |
| 123 # this mode. | 123 # this mode. |
| 124 options.AppendExtraBrowserArg('--enable-impl-side-painting') | 124 '--enable-impl-side-painting', |
| 125 options.AppendExtraBrowserArg('--force-compositing-mode') | 125 '--force-compositing-mode', |
| 126 options.AppendExtraBrowserArg('--enable-threaded-compositing') | 126 '--enable-threaded-compositing' |
| 127 ]) |
| 127 | 128 |
| 128 def MeasurePage(self, page, tab, results): | 129 def MeasurePage(self, page, tab, results): |
| 129 self._metrics = smoothness.SmoothnessMetrics(tab) | 130 self._metrics = smoothness.SmoothnessMetrics(tab) |
| 130 | 131 |
| 131 # Rasterize only what's visible. | 132 # Rasterize only what's visible. |
| 132 tab.ExecuteJavaScript( | 133 tab.ExecuteJavaScript( |
| 133 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') | 134 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') |
| 134 | 135 |
| 135 # Wait until the page has loaded and come to a somewhat steady state. | 136 # Wait until the page has loaded and come to a somewhat steady state. |
| 136 # Needs to be adjusted for every device (~2 seconds for workstation). | 137 # Needs to be adjusted for every device (~2 seconds for workstation). |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 results.Add('total_pixels_rasterized', 'pixels', | 184 results.Add('total_pixels_rasterized', 'pixels', |
| 184 collector.total_pixels_rasterized, | 185 collector.total_pixels_rasterized, |
| 185 data_type='unimportant') | 186 data_type='unimportant') |
| 186 results.Add('total_pixels_recorded', 'pixels', | 187 results.Add('total_pixels_recorded', 'pixels', |
| 187 collector.total_pixels_recorded, | 188 collector.total_pixels_recorded, |
| 188 data_type='unimportant') | 189 data_type='unimportant') |
| 189 | 190 |
| 190 if self.options.report_all_results: | 191 if self.options.report_all_results: |
| 191 for k, v in rendering_stats.iteritems(): | 192 for k, v in rendering_stats.iteritems(): |
| 192 results.Add(k, '', v) | 193 results.Add(k, '', v) |
| OLD | NEW |