mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
813 B
31 lines
813 B
var path = require("path");
|
|
var sys = require("sys");
|
|
var childProcess = require("child_process");
|
|
var benchmarks = [ "timers.js"
|
|
, "process_loop.js"
|
|
, "static_http_server.js"
|
|
];
|
|
|
|
var benchmarkDir = path.dirname(__filename);
|
|
|
|
function exec (script, callback) {
|
|
var start = new Date();
|
|
var child = childProcess.spawn(process.argv[0], [path.join(benchmarkDir, script)]);
|
|
child.addListener("exit", function (code) {
|
|
var elapsed = new Date() - start;
|
|
callback(elapsed, code);
|
|
});
|
|
}
|
|
|
|
function runNext (i) {
|
|
if (i >= benchmarks.length) return;
|
|
sys.print(benchmarks[i] + ": ");
|
|
exec(benchmarks[i], function (elapsed, code) {
|
|
if (code != 0) {
|
|
console.log("ERROR ");
|
|
}
|
|
console.log(elapsed);
|
|
runNext(i+1);
|
|
});
|
|
};
|
|
runNext(0);
|
|
|