| Index: tools/perf/measurements/new_rasterize_and_record.py
|
| diff --git a/tools/perf/measurements/new_rasterize_and_record.py b/tools/perf/measurements/new_rasterize_and_record.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..441349cc34fc2fa4aa39d6a896e6f5aa2dac663d
|
| --- /dev/null
|
| +++ b/tools/perf/measurements/new_rasterize_and_record.py
|
| @@ -0,0 +1,72 @@
|
| +# Copyright 2013 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import time
|
| +from telemetry.core.util import TimeoutException
|
| +from telemetry.page import page_measurement
|
| +
|
| +class NewRasterizeAndRecord(page_measurement.PageMeasurement):
|
| + def __init__(self):
|
| + super(NewRasterizeAndRecord, self).__init__('', True)
|
| +
|
| + def AddCommandLineOptions(self, parser):
|
| + parser.add_option('--start-wait-time', dest='start_wait_time',
|
| + default=2,
|
| + help='Wait time before the benchmark is started ' +
|
| + '(must be long enought to load all content)')
|
| + parser.add_option('--rasterize_repeat', dest='rasterize_repeat',
|
| + default=100,
|
| + help='Repeat each raster this many times. Increase ' +
|
| + 'this value to reduce variance.')
|
| + parser.add_option('--record_repeat', dest='record_repeat',
|
| + default=100,
|
| + help='Repeat each record this many times. Increase ' +
|
| + 'this value to reduce variance.')
|
| +
|
| + def CustomizeBrowserOptions(self, options):
|
| + options.AppendExtraBrowserArgs([
|
| + '--enable-impl-side-painting',
|
| + '--force-compositing-mode',
|
| + '--enable-threaded-compositing',
|
| + '--enable-gpu-benchmarking'
|
| + ])
|
| +
|
| + def MeasurePage(self, page, tab, results):
|
| + try:
|
| + tab.WaitForJavaScriptExpression("document.readyState == 'complete'", 10)
|
| + except TimeoutException:
|
| + pass
|
| + time.sleep(float(self.options.start_wait_time))
|
| +
|
| + record_repeat = self.options.record_repeat
|
| + rasterize_repeat = self.options.rasterize_repeat
|
| + # Enqueue benchmark
|
| + tab.ExecuteJavaScript("""
|
| + window.benchmark_results = {};
|
| + window.benchmark_results.done = false;
|
| + chrome.gpuBenchmarking.runMicroBenchmark(
|
| + "rasterize_and_record_benchmark",
|
| + function(value) {
|
| + window.benchmark_results.done = true;
|
| + window.benchmark_results.results = value;
|
| + }, {
|
| + "record_repeat_count": """ + str(record_repeat) + """,
|
| + "rasterize_repeat_count": """ + str(rasterize_repeat) + """
|
| + });
|
| + """)
|
| +
|
| + tab.WaitForJavaScriptExpression('window.benchmark_results.done', 300)
|
| +
|
| + data = tab.EvaluateJavaScript('window.benchmark_results.results')
|
| +
|
| + pixels_recorded = data['pixels_recorded']
|
| + record_time = data['record_time_ms']
|
| + pixels_rasterized = data['pixels_rasterized']
|
| + rasterize_time = data['rasterize_time_ms']
|
| +
|
| + results.Add('pixels_recorded', '', pixels_recorded)
|
| + results.Add('record_time', 'ms', record_time)
|
| + results.Add('pixels_rasterized', '', pixels_rasterized)
|
| + results.Add('rasterize_time', 'ms', rasterize_time)
|
| +
|
|
|