Chromium Code Reviews| Index: tools/perf/perf_tools/dromaeo.py |
| diff --git a/tools/perf/perf_tools/dromaeo.py b/tools/perf/perf_tools/dromaeo.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d7093e189acd06bc70adc51e796d7a851da2a6d4 |
| --- /dev/null |
| +++ b/tools/perf/perf_tools/dromaeo.py |
| @@ -0,0 +1,31 @@ |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from telemetry import multi_page_benchmark |
| +from telemetry import util |
| + |
| +class Dromaeo(multi_page_benchmark.MultiPageBenchmark): |
| + def MeasurePage(self, page, tab, results): |
| + js_is_done = 'window.document.cookie.indexOf("__done=1") >= 0' |
| + def _IsDone(): |
| + return bool(tab.runtime.Evaluate(js_is_done)) |
| + util.WaitFor(_IsDone, 600, poll_interval=5) |
| + |
| + js_get_results = 'JSON.stringify(window.automation.GetResults())' |
| + print js_get_results |
| + score = eval(tab.runtime.Evaluate(js_get_results)) |
| + |
| + def Escape(k): |
| + chars = [' ', '-', '/', '(', ')', '*'] |
| + for c in chars: |
| + k = k.replace(c, '_') |
| + return k |
| + |
| + for k, v in score.iteritems(): |
| + results.Add(Escape(k), 'runs/s', v) |
|
tonyg
2012/11/21 20:11:44
Let's match the existing output:
results.Add('scor
bulach
2012/11/21 20:44:06
Done.
|
| + |
| + js_get_results = 'window.automation.GetScore()' |
| + score = tab.runtime.Evaluate(js_get_results) |
| + suffix = page.url[page.url.index('?') + 1 : page.url.index('&')] |
| + results.Add('dromaeo_' + suffix, '', score) |
|
tonyg
2012/11/21 20:11:44
Again, matching the current format:
results.Add('s
bulach
2012/11/21 20:44:06
right, I'm not entirely sure what the "unimportant
|