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

Side by Side Diff: tools/perf/perf_tools/spaceport.py

Issue 11273081: Adding a test for measuring memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated Created 8 years, 1 month 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
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 4
5 from telemetry import multi_page_benchmark 5 from telemetry import multi_page_benchmark
6 from telemetry import util 6 from telemetry import util
7 7
8 class SpaceportBenchmark(multi_page_benchmark.MultiPageBenchmark): 8 class SpaceportBenchmark(multi_page_benchmark.MultiPageBenchmark):
9 def CustomizeBrowserOptions(self, options): 9 def CustomizeBrowserOptions(self, pages, options):
10 options.extra_browser_args.extend(['--disable-gpu-vsync']) 10 options.AppendExtraBrowserArg('--disable-gpu-vsync')
11 11
12 def MeasurePage(self, _, tab, results): 12 def MeasurePage(self, _, tab, results):
13 tab.runtime.Execute(""" 13 tab.runtime.Execute("""
14 window.__results = {}; 14 window.__results = {};
15 window.console.log = function(str) { 15 window.console.log = function(str) {
16 if (!str) return; 16 if (!str) return;
17 var key_val = str.split(': '); 17 var key_val = str.split(': ');
18 if (!key_val.length == 2) return; 18 if (!key_val.length == 2) return;
19 __results[key_val[0]] = key_val[1]; 19 __results[key_val[0]] = key_val[1];
20 }; 20 };
21 document.getElementById('start-performance-tests').click(); 21 document.getElementById('start-performance-tests').click();
22 """) 22 """)
23 23
24 js_get_results = 'JSON.stringify(window.__results)' 24 js_get_results = 'JSON.stringify(window.__results)'
25 def _IsDone(): 25 def _IsDone():
26 num_tests_in_benchmark = 30 26 num_tests_in_benchmark = 30
27 result_dict = eval(tab.runtime.Evaluate(js_get_results)) 27 result_dict = eval(tab.runtime.Evaluate(js_get_results))
28 return num_tests_in_benchmark == len(result_dict) 28 return num_tests_in_benchmark == len(result_dict)
29 util.WaitFor(_IsDone, 1200) 29 util.WaitFor(_IsDone, 1200)
30 30
31 result_dict = eval(tab.runtime.Evaluate(js_get_results)) 31 result_dict = eval(tab.runtime.Evaluate(js_get_results))
32 for key in result_dict: 32 for key in result_dict:
33 chart, trace = key.split('.', 1) 33 chart, trace = key.split('.', 1)
34 results.Add(trace, 'objects (bigger is better)', float(result_dict[key]), 34 results.Add(trace, 'objects (bigger is better)', float(result_dict[key]),
35 chart_name=chart, data_type='unimportant') 35 chart_name=chart, data_type='unimportant')
36 results.Add('Overall', 'objects (bigger is better)', 36 results.Add('Overall', 'objects (bigger is better)',
37 [float(x) for x in result_dict.values()]) 37 [float(x) for x in result_dict.values()])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698