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

Side by Side Diff: tools/gpu/gpu_tools/scrolling_benchmark.py

Issue 10916227: More polish in prep for CrOS support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « tools/gpu/gpu_tools/scroll.js ('k') | tools/gpu/gpu_tools/scrolling_benchmark_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import os 4 import os
5 5
6 import multi_page_benchmark 6 import multi_page_benchmark
7 import util 7 import util
8 import chrome_remote_control 8 import chrome_remote_control
9 9
10 class DidNotScrollException(multi_page_benchmark.MeasurementFailure): 10 class DidNotScrollException(multi_page_benchmark.MeasurementFailure):
(...skipping 11 matching lines...) Expand all
22 float(num_frames_sent_to_screen)) 22 float(num_frames_sent_to_screen))
23 23
24 return { 24 return {
25 "mean_frame_time_ms": util.RoundTo3DecimalPlaces( 25 "mean_frame_time_ms": util.RoundTo3DecimalPlaces(
26 mean_frame_time_seconds * 1000), 26 mean_frame_time_seconds * 1000),
27 "dropped_percent": util.RoundTo1DecimalPlace( 27 "dropped_percent": util.RoundTo1DecimalPlace(
28 dropped_percent * 100) 28 dropped_percent * 100)
29 } 29 }
30 30
31 class ScrollingBenchmark(multi_page_benchmark.MultiPageBenchmark): 31 class ScrollingBenchmark(multi_page_benchmark.MultiPageBenchmark):
32 def __init__(self):
33 super(ScrollingBenchmark, self).__init__()
34 self.use_gpu_bencharking_extension = True
35
32 def ScrollPageFully(self, tab): 36 def ScrollPageFully(self, tab):
33 scroll_js_path = os.path.join(os.path.dirname(__file__), 'scroll.js') 37 scroll_js_path = os.path.join(os.path.dirname(__file__), 'scroll.js')
34 scroll_js = open(scroll_js_path, 'r').read() 38 scroll_js = open(scroll_js_path, 'r').read()
35 39
36 # Run scroll test. 40 # Run scroll test.
37 tab.runtime.Execute(scroll_js) 41 tab.runtime.Execute(scroll_js)
38 tab.runtime.Execute(""" 42 tab.runtime.Execute("""
39 window.__scrollTestResult = null; 43 window.__scrollTestResult = null;
40 new __ScrollTest(function(rendering_stats) { 44 new __ScrollTest(function(rendering_stats) {
41 window.__scrollTestResult = rendering_stats; 45 window.__scrollTestResult = rendering_stats;
42 }); 46 });
43 """) 47 """)
44 48
45 # Poll for scroll benchmark completion. 49 # Poll for scroll benchmark completion.
46 chrome_remote_control.WaitFor( 50 chrome_remote_control.WaitFor(
47 lambda: tab.runtime.Evaluate('window.__scrollTestResult'), 60) 51 lambda: tab.runtime.Evaluate('window.__scrollTestResult'), 60)
48 52
49 rendering_stats = tab.runtime.Evaluate('window.__scrollTestResult') 53 rendering_stats = tab.runtime.Evaluate('window.__scrollTestResult')
50 54
51 if rendering_stats["numFramesSentToScreen"] == 0: 55 if not (rendering_stats["numFramesSentToScreen"] > 0):
52 raise scrolling_benchmark.DidNotScrollException() 56 raise DidNotScrollException()
53 return rendering_stats 57 return rendering_stats
54 58
55 def CustomizeBrowserOptions(self, options): 59 def CustomizeBrowserOptions(self, options):
56 options.extra_browser_args.append('--enable-gpu-benchmarking') 60 if self.use_gpu_bencharking_extension:
61 options.extra_browser_args.append('--enable-gpu-benchmarking')
57 62
58 def MeasurePage(self, page, tab): 63 def MeasurePage(self, page, tab):
59 rendering_stats = self.ScrollPageFully(tab) 64 rendering_stats = self.ScrollPageFully(tab)
60 return _CalcScrollResults(rendering_stats) 65 return _CalcScrollResults(rendering_stats)
61 66
62 67
63 def Main(): 68 def Main():
64 return multi_page_benchmark.Main(ScrollingBenchmark()) 69 return multi_page_benchmark.Main(ScrollingBenchmark())
OLDNEW
« no previous file with comments | « tools/gpu/gpu_tools/scroll.js ('k') | tools/gpu/gpu_tools/scrolling_benchmark_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698