|
|
@ -1,18 +1,15 @@ |
|
|
|
var path = require("path"); |
|
|
|
libDir = path.join(path.dirname(__filename), "../lib"); |
|
|
|
require.paths.unshift(libDir); |
|
|
|
var sys = (require("sys")); |
|
|
|
for (var i in sys) global[i] = sys[i]; |
|
|
|
var sys = require("../lib/sys"); |
|
|
|
var benchmarks = [ "static_http_server.js" |
|
|
|
, "timers.js" |
|
|
|
, "process_loop.js" |
|
|
|
]; |
|
|
|
|
|
|
|
var benchmark_dir = path.dirname(__filename); |
|
|
|
var benchmarkDir = path.dirname(__filename); |
|
|
|
|
|
|
|
function exec (script, callback) { |
|
|
|
var start = new Date(); |
|
|
|
var child = process.createChildProcess(process.ARGV[0], [path.join(benchmark_dir, script)]); |
|
|
|
var child = process.createChildProcess(process.ARGV[0], [path.join(benchmarkDir, script)]); |
|
|
|
child.addListener("exit", function (code) { |
|
|
|
var elapsed = new Date() - start; |
|
|
|
callback(elapsed, code); |
|
|
@ -21,12 +18,12 @@ function exec (script, callback) { |
|
|
|
|
|
|
|
function runNext (i) { |
|
|
|
if (i >= benchmarks.length) return; |
|
|
|
print(benchmarks[i] + ": "); |
|
|
|
sys.print(benchmarks[i] + ": "); |
|
|
|
exec(benchmarks[i], function (elapsed, code) { |
|
|
|
if (code != 0) { |
|
|
|
puts("ERROR "); |
|
|
|
sys.puts("ERROR "); |
|
|
|
} |
|
|
|
puts(elapsed); |
|
|
|
sys.puts(elapsed); |
|
|
|
runNext(i+1); |
|
|
|
}); |
|
|
|
}; |
|
|
|