-
Notifications
You must be signed in to change notification settings - Fork 30.4k
/
Copy pathrun.js
32 lines (29 loc) · 871 Bytes
/
run.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
libDir = node.path.join(node.path.dirname(__filename), "../lib");
node.libraryPaths.unshift(libDir);
node.mixin(require("/utils.js"));
var benchmarks = [ "static_http_server.js"
, "timers.js"
, "process_loop.js"
];
var benchmark_dir = node.path.dirname(__filename);
function exec (script, callback) {
var command = ARGV[0] + " " + node.path.join(benchmark_dir, script);
var start = new Date();
var child = node.createChildProcess(command);
child.addListener("exit", function (code) {
var elapsed = new Date() - start;
callback(elapsed, code);
});
}
function runNext (i) {
if (i >= benchmarks.length) return;
print(benchmarks[i] + ": ");
exec(benchmarks[i], function (elapsed, code) {
if (code != 0) {
puts("ERROR ");
}
puts(elapsed);
runNext(i+1);
});
};
runNext(0);