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

Side by Side Diff: tools/perf/perf_tools/dromaeo.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
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 class Dromaeo(multi_page_benchmark.MultiPageBenchmark): 8 class Dromaeo(multi_page_benchmark.MultiPageBenchmark):
9 def MeasurePage(self, page, tab, results): 9 def MeasurePage(self, page, tab, results):
10 js_is_done = 'window.document.cookie.indexOf("__done=1") >= 0' 10 js_is_done = 'window.document.cookie.indexOf("__done=1") >= 0'
11 def _IsDone(): 11 def _IsDone():
12 return bool(tab.EvaluateJavaScript(js_is_done)) 12 return bool(tab.EvaluateJavaScript(js_is_done))
13 util.WaitFor(_IsDone, 600, poll_interval=5) 13 util.WaitFor(_IsDone, 600, poll_interval=5)
14 14
15 js_get_results = 'JSON.stringify(window.automation.GetResults())' 15 js_get_results = 'JSON.stringify(window.automation.GetResults())'
16 print js_get_results 16 print js_get_results
17 score = eval(tab.EvaluateJavaScript(js_get_results)) 17 score = eval(tab.EvaluateJavaScript(js_get_results))
18 18
19 def Escape(k): 19 def Escape(k):
20 chars = [' ', '-', '/', '(', ')', '*'] 20 chars = [' ', '-', '/', '(', ')', '*']
21 for c in chars: 21 for c in chars:
22 k = k.replace(c, '_') 22 k = k.replace(c, '_')
23 return k 23 return k
24 24
25 suffix = page.url[page.url.index('?') + 1 : page.url.index('&')] 25 suffix = page.url[page.url.index('?') + 1 : page.url.index('&')]
26 for k, v in score.iteritems(): 26 for k, v in score.iteritems():
27 data_type = 'unimportant' 27 data_type = 'unimportant'
28 if k == suffix: 28 if k == suffix:
29 data_type = 'default' 29 data_type = 'default'
30 results.Add('score', 'runs/s', v, chart_name=Escape(k), 30 results.Add('score', 'runs/s', v, chart_name=Escape(k),
31 data_type=data_type) 31 data_type=data_type)
OLDNEW
« no previous file with comments | « tools/perf/page_sets/page_sets_unittest.py ('k') | tools/perf/perf_tools/image_decoding_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698