From ae9aa3daf18a85334b5d3fb56a477aee1b315e02 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Wed, 5 Jun 2013 02:37:36 +0000 Subject: Clear image cache before running a benchmark Added this JS benchmarking API to clear image cache: chrome.gpuBenchmarkingExtension.clearImageCache Used this API to clear image cahe for these measurements: image_decoding_measurement rasterize_and_record_benchmark BUG=241943 Review URL: https://chromiumcodereview.appspot.com/15801004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204132 0039d316-1c4b-4281-b951-d872f2087c98 --- tools/perf/perf_tools/image_decoding_measurement.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tools/perf') diff --git a/tools/perf/perf_tools/image_decoding_measurement.py b/tools/perf/perf_tools/image_decoding_measurement.py index 4da7838..c0351fef 100644 --- a/tools/perf/perf_tools/image_decoding_measurement.py +++ b/tools/perf/perf_tools/image_decoding_measurement.py @@ -6,9 +6,26 @@ from telemetry.page import page_measurement class ImageDecoding(page_measurement.PageMeasurement): + def CustomizeBrowserOptions(self, options): + options.extra_browser_args.append('--enable-gpu-benchmarking') + def WillNavigateToPage(self, page, tab): + tab.ExecuteJavaScript(""" + if (window.chrome && + chrome.gpuBenchmarking && + chrome.gpuBenchmarking.clearImageCache) { + chrome.gpuBenchmarking.clearImageCache(); + } + """) tab.StartTimelineRecording() + def NeedsBrowserRestartAfterEachRun(self, tab): + return not tab.ExecuteJavaScript(""" + window.chrome && + chrome.gpuBenchmarking && + chrome.gpuBenchmarking.clearImageCache; + """) + def MeasurePage(self, page, tab, results): tab.StopTimelineRecording() def _IsDone(): -- cgit v1.1