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

Unified Diff: tools/perf/benchmarks/jetstream.py

Issue 314263002: [Telemetry] Automate the JetStream benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | tools/perf/page_sets/data/jetstream.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/benchmarks/jetstream.py
diff --git a/tools/perf/benchmarks/jetstream.py b/tools/perf/benchmarks/jetstream.py
new file mode 100644
index 0000000000000000000000000000000000000000..6c1433d79ca067afc6ec9142de3736f97bed2431
--- /dev/null
+++ b/tools/perf/benchmarks/jetstream.py
@@ -0,0 +1,82 @@
+# Copyright (c) 2014 The Chromium Authors. All rights reserved.
dtu 2014/06/05 21:51:45 nit: No (c)
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Runs Apple's JetStream benchmark.
+
+JetStream combines a variety of JavaScript benchmarks, covering a variety of
+advanced workloads and programming techniques, and reports a single score that
+balances them using geometric mean.
+
+Each benchmark measures a distinct workload, and no single optimization
+technique is sufficient to speed up all benchmarks. Latency tests measure that
+a web application can start up quickly, ramp up to peak performance quickly,
+and run smoothly without interruptions. Throughput tests measure the sustained
+peak performance of a web application, ignoring ramp-up time and spikes in
+smoothness. Some benchmarks demonstrate tradeoffs, and aggressive or
+specialized optimization for one benchmark might make another benchmark slower.
+"""
+
+import json
+import os
+
+from telemetry import test
+from telemetry.page import page_measurement
+from telemetry.page import page_set
+from telemetry.util import statistics
+from telemetry.value import scalar
+
+
+class _JetstreamMeasurement(page_measurement.PageMeasurement):
+ def __init__(self):
+ super(_JetstreamMeasurement, self).__init__()
+
+ def WillNavigateToPage(self, page, tab):
+ page.script_to_evaluate_on_commit = """
+ var __results = [];
+ var __real_log = window.console.log;
+ window.console.log = function() {
+ __results.push(Array.prototype.join.call(arguments, ' '));
+ __real_log.apply(this, arguments);
+ }
+ """
+
+ def MeasurePage(self, page, tab, results):
+ get_results_js = """
+ (function() {
+ for (var i = 0; i < __results.length; i++) {
+ if (!__results[i].indexOf('Raw results: ')) return __results[i];
+ }
+ return null;
+ })();
+ """
+
+ tab.WaitForDocumentReadyStateToBeComplete()
+ tab.EvaluateJavaScript('JetStream.start()')
+ tab.WaitForJavaScriptExpression(get_results_js, 600)
+
+ result = tab.EvaluateJavaScript(get_results_js)
+ result = json.loads(result.partition(': ')[2])
+
+ all_scores = []
+ for k, v in result.iteritems():
+ results.Add(k.replace('.', '_'), 'score', v['result'],
+ data_type='unimportant')
+ # Collect all test scores to compute geometric mean.
+ all_scores.extend(v['result'])
+ total = statistics.GeometricMean(all_scores)
+ results.AddSummaryValue(
+ scalar.ScalarValue(None, 'Score', 'score', total))
+
+
+@test.Disabled('android') # Crashes on GN.
+class Jetstream(test.Test):
+ test = _JetstreamMeasurement
+
+ def CreatePageSet(self, options):
+ ps = page_set.PageSet(
+ archive_data_file='../page_sets/data/jetstream.json',
+ make_javascript_deterministic=False,
+ file_path=os.path.abspath(__file__))
+ ps.AddPageWithDefaultRunNavigate('http://browserbench.org/JetStream/')
+ return ps
« no previous file with comments | « no previous file | tools/perf/page_sets/data/jetstream.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698