2009-07-13 12:48:59 +02:00
|
|
|
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();
|
2009-08-26 22:11:51 +02:00
|
|
|
var child = node.createChildProcess(command);
|
|
|
|
child.addListener("exit", function (code) {
|
2009-07-13 12:48:59 +02:00
|
|
|
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);
|