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

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

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 years, 10 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/perf/perf_tools/jsgamebench.py ('k') | tools/perf/perf_tools/loading_benchmark.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 4
5 from telemetry import multi_page_benchmark 5 from telemetry.core import util
6 from telemetry import util 6 from telemetry.page import multi_page_benchmark
7 7
8 def _Mean(l): 8 def _Mean(l):
9 return float(sum(l)) / len(l) if len(l) > 0 else 0.0 9 return float(sum(l)) / len(l) if len(l) > 0 else 0.0
10 10
11 class Kraken(multi_page_benchmark.MultiPageBenchmark): 11 class Kraken(multi_page_benchmark.MultiPageBenchmark):
12 def MeasurePage(self, _, tab, results): 12 def MeasurePage(self, _, tab, results):
13 js_is_done = """ 13 js_is_done = """
14 document.title.indexOf("Results") != -1 && document.readyState == "complete" 14 document.title.indexOf("Results") != -1 && document.readyState == "complete"
15 """ 15 """
16 def _IsDone(): 16 def _IsDone():
17 return bool(tab.EvaluateJavaScript(js_is_done)) 17 return bool(tab.EvaluateJavaScript(js_is_done))
18 util.WaitFor(_IsDone, 500, poll_interval=5) 18 util.WaitFor(_IsDone, 500, poll_interval=5)
19 19
20 js_get_results = """ 20 js_get_results = """
21 var formElement = document.getElementsByTagName("input")[0]; 21 var formElement = document.getElementsByTagName("input")[0];
22 decodeURIComponent(formElement.value.split("?")[1]); 22 decodeURIComponent(formElement.value.split("?")[1]);
23 """ 23 """
24 result_dict = eval(tab.EvaluateJavaScript(js_get_results)) 24 result_dict = eval(tab.EvaluateJavaScript(js_get_results))
25 total = 0 25 total = 0
26 for key in result_dict: 26 for key in result_dict:
27 if key == 'v': 27 if key == 'v':
28 continue 28 continue
29 results.Add(key, 'ms', result_dict[key], data_type='unimportant') 29 results.Add(key, 'ms', result_dict[key], data_type='unimportant')
30 total += _Mean(result_dict[key]) 30 total += _Mean(result_dict[key])
31 results.Add('Total', 'ms', total) 31 results.Add('Total', 'ms', total)
OLDNEW
« no previous file with comments | « tools/perf/perf_tools/jsgamebench.py ('k') | tools/perf/perf_tools/loading_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698