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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/perf/page_sets/data/jetstream.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
dtu 2014/06/05 21:51:45 nit: No (c)
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Runs Apple's JetStream benchmark.
6
7 JetStream combines a variety of JavaScript benchmarks, covering a variety of
8 advanced workloads and programming techniques, and reports a single score that
9 balances them using geometric mean.
10
11 Each benchmark measures a distinct workload, and no single optimization
12 technique is sufficient to speed up all benchmarks. Latency tests measure that
13 a web application can start up quickly, ramp up to peak performance quickly,
14 and run smoothly without interruptions. Throughput tests measure the sustained
15 peak performance of a web application, ignoring ramp-up time and spikes in
16 smoothness. Some benchmarks demonstrate tradeoffs, and aggressive or
17 specialized optimization for one benchmark might make another benchmark slower.
18 """
19
20 import json
21 import os
22
23 from telemetry import test
24 from telemetry.page import page_measurement
25 from telemetry.page import page_set
26 from telemetry.util import statistics
27 from telemetry.value import scalar
28
29
30 class _JetstreamMeasurement(page_measurement.PageMeasurement):
31 def __init__(self):
32 super(_JetstreamMeasurement, self).__init__()
33
34 def WillNavigateToPage(self, page, tab):
35 page.script_to_evaluate_on_commit = """
36 var __results = [];
37 var __real_log = window.console.log;
38 window.console.log = function() {
39 __results.push(Array.prototype.join.call(arguments, ' '));
40 __real_log.apply(this, arguments);
41 }
42 """
43
44 def MeasurePage(self, page, tab, results):
45 get_results_js = """
46 (function() {
47 for (var i = 0; i < __results.length; i++) {
48 if (!__results[i].indexOf('Raw results: ')) return __results[i];
49 }
50 return null;
51 })();
52 """
53
54 tab.WaitForDocumentReadyStateToBeComplete()
55 tab.EvaluateJavaScript('JetStream.start()')
56 tab.WaitForJavaScriptExpression(get_results_js, 600)
57
58 result = tab.EvaluateJavaScript(get_results_js)
59 result = json.loads(result.partition(': ')[2])
60
61 all_scores = []
62 for k, v in result.iteritems():
63 results.Add(k.replace('.', '_'), 'score', v['result'],
64 data_type='unimportant')
65 # Collect all test scores to compute geometric mean.
66 all_scores.extend(v['result'])
67 total = statistics.GeometricMean(all_scores)
68 results.AddSummaryValue(
69 scalar.ScalarValue(None, 'Score', 'score', total))
70
71
72 @test.Disabled('android') # Crashes on GN.
73 class Jetstream(test.Test):
74 test = _JetstreamMeasurement
75
76 def CreatePageSet(self, options):
77 ps = page_set.PageSet(
78 archive_data_file='../page_sets/data/jetstream.json',
79 make_javascript_deterministic=False,
80 file_path=os.path.abspath(__file__))
81 ps.AddPageWithDefaultRunNavigate('http://browserbench.org/JetStream/')
82 return ps
OLDNEW
« 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