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

Unified Diff: tools/perf/perf_tools/kraken.py

Issue 11348021: Automate Kraken benchmark with Chrome Remote Control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/page_sets/kraken.json ('k') | tools/perf/perf_tools/multipage_benchmark_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/perf_tools/kraken.py
diff --git a/tools/perf/perf_tools/kraken.py b/tools/perf/perf_tools/kraken.py
new file mode 100644
index 0000000000000000000000000000000000000000..3110452a9d4ec91a24425270528c4f74e02cffa1
--- /dev/null
+++ b/tools/perf/perf_tools/kraken.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 chrome_remote_control import multi_page_benchmark
+from chrome_remote_control import util
+
+def _Mean(l):
+ return float(sum(l)) / len(l) if len(l) > 0 else 0.0
+
+class Kraken(multi_page_benchmark.MultiPageBenchmark):
+ def MeasurePage(self, _, tab, results):
+ js_is_done = """
+document.title.indexOf("Results") != -1 && document.readyState == "complete"
+"""
+ def _IsDone():
+ return bool(tab.runtime.Evaluate(js_is_done))
+ util.WaitFor(_IsDone, 300)
+
+ js_get_results = """
+var formElement = document.getElementsByTagName("input")[0];
+decodeURIComponent(formElement.value.split("?")[1]);
+"""
+ result_dict = eval(tab.runtime.Evaluate(js_get_results))
+ total = 0
+ for key in result_dict:
+ if key == 'v':
+ continue
+ results.Add(key, 'ms', result_dict[key])
+ total += _Mean(result_dict[key])
+ results.Add('Total', 'ms', total)
« no previous file with comments | « tools/perf/page_sets/kraken.json ('k') | tools/perf/perf_tools/multipage_benchmark_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698