summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authortonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-30 18:37:39 +0000
committertonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-30 18:37:39 +0000
commitcf4d52c90d21f94e122910353d8b15ac9b17e87c (patch)
tree7e6e278d1ee6dc78718f9b78fc3eae95fab9f0ab /tools
parent058a724afd21cb4489ff5e0d9f511a008f07fb03 (diff)
downloadchromium_src-cf4d52c90d21f94e122910353d8b15ac9b17e87c.zip
chromium_src-cf4d52c90d21f94e122910353d8b15ac9b17e87c.tar.gz
chromium_src-cf4d52c90d21f94e122910353d8b15ac9b17e87c.tar.bz2
Automate Kraken benchmark with Chrome Remote Control.
This uses web page replay to record the benchmark itself so it deletes the unused kraken data checked into chrome/test/data. BUG=126516 TEST=Manual on linux Review URL: https://codereview.chromium.org/11348021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164951 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/page_sets/kraken.json9
-rw-r--r--tools/perf/perf_tools/kraken.py31
-rwxr-xr-xtools/perf/perf_tools/multipage_benchmark_runner.py3
3 files changed, 43 insertions, 0 deletions
diff --git a/tools/perf/page_sets/kraken.json b/tools/perf/page_sets/kraken.json
new file mode 100644
index 0000000..e6c5a6f
--- /dev/null
+++ b/tools/perf/page_sets/kraken.json
@@ -0,0 +1,9 @@
+{
+ "description": "Kraken JavaScript benchmark",
+ "archive_path": "../data/kraken.wpr",
+ "pages": [
+ {
+ "url": "http://krakenbenchmark.mozilla.org/kraken-1.1/driver.html"
+ }
+ ]
+}
diff --git a/tools/perf/perf_tools/kraken.py b/tools/perf/perf_tools/kraken.py
new file mode 100644
index 0000000..3110452
--- /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)
diff --git a/tools/perf/perf_tools/multipage_benchmark_runner.py b/tools/perf/perf_tools/multipage_benchmark_runner.py
index db7861c..d90b2d5 100755
--- a/tools/perf/perf_tools/multipage_benchmark_runner.py
+++ b/tools/perf/perf_tools/multipage_benchmark_runner.py
@@ -14,6 +14,7 @@ from chrome_remote_control import page_runner
from chrome_remote_control import page_set
import perf_tools.first_paint_time_benchmark
+import perf_tools.kraken
import perf_tools.scrolling_benchmark
import perf_tools.skpicture_printer
import perf_tools.texture_upload_benchmark
@@ -22,6 +23,8 @@ import perf_tools.texture_upload_benchmark
_BENCHMARKS = {
'first_paint_time_benchmark':
perf_tools.first_paint_time_benchmark.FirstPaintTimeBenchmark,
+ 'kraken':
+ perf_tools.kraken.Kraken,
'scrolling_benchmark':
perf_tools.scrolling_benchmark.ScrollingBenchmark,
'skpicture_printer':