author | hannesw |
Wed, 25 Jun 2014 14:36:24 +0200 | |
changeset 25243 | 7a1edca6ce94 |
parent 24778 | 2ff5d7041566 |
child 25821 | fbb51e67d2a7 |
permissions | -rw-r--r-- |
16147 | 1 |
/* |
16151 | 2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
16147 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
4 |
* |
16147 | 5 |
* This code is free software; you can redistribute it and/or modify it |
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
8 |
* |
16147 | 9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
14 |
* |
16147 | 15 |
* You should have received a copy of the GNU General Public License version |
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
18 |
* |
16147 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/** |
|
25 |
* @subtest |
|
26 |
*/ |
|
27 |
||
24743
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
28 |
|
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
29 |
function initZlib() { |
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
30 |
zlib = new BenchmarkSuite('zlib', [152815148], [ |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
31 |
new Benchmark('zlib', false, true, 10, |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
32 |
runZlib, undefined, tearDownZlib, null, 3)]); |
24743
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
33 |
} |
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
34 |
|
16147 | 35 |
var tests = [ |
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
36 |
{name:"box2d", files:["box2d.js"], suite:"Box2DBenchmark"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
37 |
{name:"code-load", files:["code-load.js"], suite:"CodeLoad"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
38 |
{name:"crypto", files:["crypto.js"], suite:"Crypto"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
39 |
{name:"deltablue", files:["deltablue.js"], suite:"DeltaBlue"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
40 |
{name:"earley-boyer", files:["earley-boyer.js"], suite:"EarleyBoyer"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
41 |
{name:"gbemu", files:["gbemu-part1.js", "gbemu-part2.js"], suite:"GameboyBenchmark"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
42 |
{name:"mandreel", files:["mandreel.js"], suite:"MandreelBenchmark"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
43 |
{name:"navier-stokes", files:["navier-stokes.js"], suite:"NavierStokes"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
44 |
{name:"pdfjs", files:["pdfjs.js"], suite:"PdfJS"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
45 |
{name:"raytrace", files:["raytrace.js"], suite:"RayTrace"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
46 |
{name:"regexp", files:["regexp.js"], suite:"RegExpSuite"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
47 |
{name:"richards", files:["richards.js"], suite:"Richards"}, |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
48 |
{name:"splay", files:["splay.js"], suite:"Splay"}, |
24743
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
49 |
{name:"typescript", files:["typescript.js", "typescript-input.js", "typescript-compiler.js"], suite:"typescript"}, |
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
50 |
//zlib currently disabled - requires read |
24743
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
51 |
{name:"zlib", files:["zlib.js", "zlib-data.js"], suite:"zlib", before:initZlib} |
16147 | 52 |
]; |
53 |
var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__; |
|
54 |
||
55 |
// TODO: why is this path hard coded when it's defined in project properties? |
|
16163
71f4cff209a9
8005940: provide ant targets to get and update external test scripts
sundar
parents:
16151
diff
changeset
|
56 |
var path = dir + "../external/octane/"; |
16147 | 57 |
|
24767
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
58 |
var runtime = undefined; |
16147 | 59 |
var verbose = false; |
60 |
||
61 |
var numberOfIterations = 5; |
|
62 |
||
63 |
function endsWith(str, suffix) { |
|
64 |
return str.indexOf(suffix, str.length - suffix.length) !== -1; |
|
65 |
} |
|
66 |
||
16525
1409942e618e
8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents:
16201
diff
changeset
|
67 |
function should_compile_only(name) { |
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
68 |
return (typeof compile_only !== 'undefined') |
16525
1409942e618e
8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents:
16201
diff
changeset
|
69 |
} |
1409942e618e
8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents:
16201
diff
changeset
|
70 |
|
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
71 |
function load_bench(arg) { |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
72 |
|
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
73 |
for (var idx = 0; idx < arg.files.length; idx++) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
74 |
var f = arg.files[idx]; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
75 |
var file = f.split('/'); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
76 |
var file_name = path + file[file.length - 1]; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
77 |
|
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
78 |
var compile_and_return = should_compile_only(file_name); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
79 |
if (compile_and_return) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
80 |
if (typeof compile_only === 'undefined') { //for a run, skip compile onlies, don't even compile them |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
81 |
return true; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
82 |
} |
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
83 |
} |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
84 |
|
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
85 |
print_verbose(arg, "loading '" + arg.name + "' [" + f + "]..."); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
86 |
load(file_name); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
87 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
88 |
|
24743
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
89 |
if (typeof arg.before !== 'undefined') { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
90 |
arg.before(); |
24743
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
91 |
} |
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
92 |
|
16525
1409942e618e
8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents:
16201
diff
changeset
|
93 |
if (compile_and_return) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
94 |
print_always(arg, "Compiled OK"); |
16201
889ddb179cdf
8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents:
16163
diff
changeset
|
95 |
} |
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
96 |
return !compile_and_return; |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
97 |
|
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
98 |
} |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
99 |
|
24743
138ee369abd8
8033105: Make sure Nashorn test harness can run zlib benchmark
lagergren
parents:
24740
diff
changeset
|
100 |
|
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
101 |
function run_one_benchmark(arg, iters) { |
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
102 |
|
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
103 |
if (!load_bench(arg)) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
104 |
return; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
105 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
106 |
|
16147 | 107 |
var success = true; |
108 |
var current_name; |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
109 |
|
16147 | 110 |
if (iters == undefined) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
111 |
iters = numberOfIterations; |
16147 | 112 |
} else { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
113 |
numberOfIterations = iters; |
16147 | 114 |
} |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
115 |
|
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
116 |
var benchmarks = eval(arg.suite + ".benchmarks"); |
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
117 |
var min_score = 1e9; |
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
118 |
var max_score = 0; |
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
119 |
var mean_score = 0; |
17777
3f0a680149b9
8015447: Octane harness fixes for rhino and entire test runs: ant octane, ant octane-v8, ant octane-rhino
lagergren
parents:
17774
diff
changeset
|
120 |
|
3f0a680149b9
8015447: Octane harness fixes for rhino and entire test runs: ant octane, ant octane-v8, ant octane-rhino
lagergren
parents:
17774
diff
changeset
|
121 |
try { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
122 |
for (var x = 0; x < benchmarks.length ; x++) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
123 |
//do warmup run |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
124 |
//reset random number generator needed as of octane 9 before each run |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
125 |
BenchmarkSuite.ResetRNG(); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
126 |
benchmarks[x].Setup(); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
127 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
128 |
BenchmarkSuite.ResetRNG(); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
129 |
print_verbose(arg, "running '" + arg.name + "' for " + iters + " iterations of no less than " + min_time + " seconds"); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
130 |
|
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
131 |
var scores = []; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
132 |
|
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
133 |
var min_time_ms = min_time * 1000; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
134 |
var len = benchmarks.length; |
17777
3f0a680149b9
8015447: Octane harness fixes for rhino and entire test runs: ant octane, ant octane-v8, ant octane-rhino
lagergren
parents:
17774
diff
changeset
|
135 |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
136 |
for (var it = 0; it < iters + 1; it++) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
137 |
//every iteration must take a minimum of 10 secs |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
138 |
var ops = 0; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
139 |
var elapsed = 0; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
140 |
var start = new Date; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
141 |
do { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
142 |
for (var i = 0; i < len; i++) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
143 |
benchmarks[i].run(); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
144 |
//important - no timing here like elapsed = new Date() - start, as in the |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
145 |
//original harness. This will make timing very non-deterministic. |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
146 |
//NOTHING else must live in this loop |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
147 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
148 |
ops += len; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
149 |
elapsed = new Date - start; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
150 |
} while (elapsed < min_time * 1000); |
17777
3f0a680149b9
8015447: Octane harness fixes for rhino and entire test runs: ant octane, ant octane-v8, ant octane-rhino
lagergren
parents:
17774
diff
changeset
|
151 |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
152 |
var score = ops / elapsed * 1000 * 60; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
153 |
scores.push(score); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
154 |
var name = it == 0 ? "warmup" : "iteration " + it; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
155 |
print_verbose(arg, name + " finished " + score.toFixed(0) + " ops/minute"); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
156 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
157 |
|
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
158 |
for (var x = 0; x < benchmarks.length ; x++) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
159 |
benchmarks[x].TearDown(); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
160 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
161 |
|
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
162 |
for (var x = 1; x < iters + 1 ; x++) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
163 |
mean_score += scores[x]; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
164 |
min_score = Math.min(min_score, scores[x]); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
165 |
max_score = Math.max(max_score, scores[x]); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
166 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
167 |
mean_score /= iters; |
17777
3f0a680149b9
8015447: Octane harness fixes for rhino and entire test runs: ant octane, ant octane-v8, ant octane-rhino
lagergren
parents:
17774
diff
changeset
|
168 |
} catch (e) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
169 |
print_always(arg, "*** Aborted and setting score to zero. Reason: " + e); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
170 |
if (e instanceof java.lang.Throwable) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
171 |
e.printStackTrace(); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
172 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
173 |
mean_score = min_score = max_score = 0; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
174 |
scores = [0]; |
16147 | 175 |
} |
17777
3f0a680149b9
8015447: Octane harness fixes for rhino and entire test runs: ant octane, ant octane-v8, ant octane-rhino
lagergren
parents:
17774
diff
changeset
|
176 |
|
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
177 |
var res = mean_score.toFixed(0); |
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
178 |
if (verbose) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
179 |
res += " ops/minute (" + min_score.toFixed(0) + "-" + max_score.toFixed(0) + "), warmup=" + scores[0].toFixed(0); |
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
180 |
} |
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
181 |
print_always(arg, res); |
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
182 |
} |
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
183 |
|
24767
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
184 |
function runtime_string() { |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
185 |
return runtime == undefined ? "" : ("[" + runtime + "] "); |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
186 |
} |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
187 |
|
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
188 |
function print_always(arg, x) { |
24767
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
189 |
print(runtime_string() + "[" + arg.name + "] " + x); |
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
190 |
} |
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
191 |
|
22384
042ba96233f6
8029780: "ant externals" broke our test harness with the latest version of the octane benchmarks
lagergren
parents:
17777
diff
changeset
|
192 |
function print_verbose(arg, x) { |
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
193 |
if (verbose) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
194 |
print_always(arg, x) |
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
195 |
} |
16147 | 196 |
} |
197 |
||
198 |
function run_suite(tests, iters) { |
|
199 |
for (var idx = 0; idx < tests.length; idx++) { |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
200 |
run_one_benchmark(tests[idx], iters); |
16147 | 201 |
} |
202 |
} |
|
203 |
||
204 |
var args = []; |
|
17777
3f0a680149b9
8015447: Octane harness fixes for rhino and entire test runs: ant octane, ant octane-v8, ant octane-rhino
lagergren
parents:
17774
diff
changeset
|
205 |
|
16147 | 206 |
if (typeof $ARGS !== 'undefined') { |
207 |
args = $ARGS; |
|
208 |
} else if (typeof arguments !== 'undefined' && arguments.length != 0) { |
|
209 |
args = arguments; |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
210 |
} |
16147 | 211 |
|
212 |
var new_args = []; |
|
213 |
for (i in args) { |
|
214 |
if (args[i].toString().indexOf(' ') != -1) { |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
215 |
args[i] = args[i].replace(/\/$/, ''); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
216 |
var s = args[i].split(' '); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
217 |
for (j in s) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
218 |
new_args.push(s[j]); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
219 |
} |
16147 | 220 |
} else { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
221 |
new_args.push(args[i]); |
16147 | 222 |
} |
223 |
} |
|
224 |
||
225 |
if (new_args.length != 0) { |
|
226 |
args = new_args; |
|
227 |
} |
|
228 |
||
229 |
var tests_found = []; |
|
230 |
var iters = undefined; |
|
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
231 |
var min_time = 5; |
16147 | 232 |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
233 |
for (var i = 0; i < args.length; i++) { |
16147 | 234 |
arg = args[i]; |
235 |
if (arg == "--iterations") { |
|
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
236 |
iters = +args[++i]; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
237 |
if (isNaN(iters)) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
238 |
throw "'--iterations' must be followed by integer"; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
239 |
} |
16147 | 240 |
} else if (arg == "--runtime") { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
241 |
runtime = args[++i]; |
16147 | 242 |
} else if (arg == "--verbose") { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
243 |
verbose = true; |
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
244 |
} else if (arg == "--min-time") { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
245 |
min_time = +args[++i]; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
246 |
if (isNaN(iters)) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
247 |
throw "'--min-time' must be followed by integer"; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
248 |
} |
16147 | 249 |
} else if (arg == "") { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
250 |
continue; //skip |
16147 | 251 |
} else { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
252 |
var found = false; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
253 |
for (j in tests) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
254 |
if (tests[j].name === arg) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
255 |
tests_found.push(tests[j]); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
256 |
found = true; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
257 |
break; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
258 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
259 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
260 |
if (!found) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
261 |
var str = "unknown test name: '" + arg + "' -- valid names are: "; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
262 |
for (j in tests) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
263 |
if (j != 0) { |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
264 |
str += ", "; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
265 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
266 |
str += "'" + tests[j].name + "'"; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
267 |
} |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
268 |
throw str; |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
269 |
} |
16147 | 270 |
} |
271 |
} |
|
272 |
||
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
273 |
if (tests_found.length == 0) { |
16147 | 274 |
for (i in tests) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
275 |
tests_found.push(tests[i]); |
16147 | 276 |
} |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
277 |
} |
16147 | 278 |
|
24767
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
279 |
// returns false for rhino, v8 and all other javascript runtimes, true for Nashorn |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
280 |
function is_this_nashorn() { |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
281 |
return typeof Error.dumpStack == 'function' |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
282 |
} |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
283 |
|
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
284 |
if (is_this_nashorn()) { |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
285 |
try { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
286 |
read = readFully; |
24767
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
287 |
} catch (e) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
288 |
print("ABORTING: Cannot find 'readFully'. You must have scripting enabled to use this test harness. (-scripting)"); |
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
289 |
throw e; |
24767
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
290 |
} |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
291 |
} |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
292 |
|
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
293 |
// run tests in alphabetical order by name |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
294 |
tests_found.sort(function(a, b) { |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
295 |
if (a.name < b.name) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
296 |
return -1; |
24767
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
297 |
} else if (a.name > b.name) { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
298 |
return 1; |
24767
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
299 |
} else { |
24778
2ff5d7041566
8044638: Tidy up Nashorn codebase for code standards
attila
parents:
24767
diff
changeset
|
300 |
return 0; |
24767
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
301 |
} |
0b8af588070b
8044012: Integrate the latest best known performance flags int ant octane jobs, and make sure that it's easy to compare 'ant octane-nashorn' and 'ant octane-v8' at the push of a button. (or rather; the entry of a command line)
lagergren
parents:
24761
diff
changeset
|
302 |
}); |
16147 | 303 |
|
17774
0407501fa563
8014219: Make the run-octane harness more deterministic by not measuring elapsed time every iteration. Also got rid of most of the run logic in base.js and call benchmarks directly for the same purpose
lagergren
parents:
16525
diff
changeset
|
304 |
load(path + 'base.js'); |
16147 | 305 |
run_suite(tests_found, iters); |