Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/perf/measurements/skpicture_printer.py

Issue 809393002: Added support for improvement_direction to relevant values, which is propogated to chartjson. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linter issues Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2012 The Chromium Authors. All rights reserved. 1 # Copyright 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 import glob 4 import glob
5 import os 5 import os
6 6
7 from telemetry.page import page_test 7 from telemetry.page import page_test
8 from telemetry.value import improvement_direction
8 from telemetry.value import scalar 9 from telemetry.value import scalar
9 10
10 11
11 _JS = 'chrome.gpuBenchmarking.printToSkPicture("{0}");' 12 _JS = 'chrome.gpuBenchmarking.printToSkPicture("{0}");'
12 13
13 14
14 class SkpicturePrinter(page_test.PageTest): 15 class SkpicturePrinter(page_test.PageTest):
15 def __init__(self, skp_outdir): 16 def __init__(self, skp_outdir):
16 super(SkpicturePrinter, self).__init__() 17 super(SkpicturePrinter, self).__init__()
17 self._skp_outdir = skp_outdir 18 self._skp_outdir = skp_outdir
18 19
19 def CustomizeBrowserOptions(self, options): 20 def CustomizeBrowserOptions(self, options):
20 options.AppendExtraBrowserArgs(['--enable-gpu-benchmarking', 21 options.AppendExtraBrowserArgs(['--enable-gpu-benchmarking',
21 '--no-sandbox', 22 '--no-sandbox',
22 '--enable-deferred-image-decoding']) 23 '--enable-deferred-image-decoding'])
23 24
24 def ValidateAndMeasurePage(self, page, tab, results): 25 def ValidateAndMeasurePage(self, page, tab, results):
25 if tab.browser.platform.GetOSName() in ['android', 'chromeos']: 26 if tab.browser.platform.GetOSName() in ['android', 'chromeos']:
26 raise page_test.MeasurementFailure( 27 raise page_test.MeasurementFailure(
27 'SkPicture printing not supported on this platform') 28 'SkPicture printing not supported on this platform')
28 29
29 # Replace win32 path separator char '\' with '\\'. 30 # Replace win32 path separator char '\' with '\\'.
30 outpath = os.path.abspath( 31 outpath = os.path.abspath(
31 os.path.join(self._skp_outdir, page.file_safe_name)) 32 os.path.join(self._skp_outdir, page.file_safe_name))
32 js = _JS.format(outpath.replace('\\', '\\\\')) 33 js = _JS.format(outpath.replace('\\', '\\\\'))
33 tab.EvaluateJavaScript(js) 34 tab.EvaluateJavaScript(js)
34 pictures = glob.glob(os.path.join(outpath, '*.skp')) 35 pictures = glob.glob(os.path.join(outpath, '*.skp'))
35 results.AddValue(scalar.ScalarValue( 36 results.AddValue(scalar.ScalarValue(
36 results.current_page, 'saved_picture_count', 'count', len(pictures))) 37 results.current_page, 'saved_picture_count', 'count', len(pictures),
38 improvement_direction=improvement_direction.DOWN))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698