bench: Make http easier to profile
authorisaacs <i@izs.me>
Mon, 25 Feb 2013 16:30:05 +0000 (08:30 -0800)
committerisaacs <i@izs.me>
Tue, 26 Feb 2013 01:47:28 +0000 (17:47 -0800)
Do not run the http/simple.js server in a child process.

Fix #4831

benchmark/http/simple.js
benchmark/http_simple.js

index 04a2a29..8a1be98 100644 (file)
@@ -11,14 +11,13 @@ var bench = common.createBenchmark(main, {
 function main(conf) {
   process.env.PORT = PORT;
   var spawn = require('child_process').spawn;
-  var simple = require('path').resolve(__dirname, '../http_simple.js');
-  var server = spawn(process.execPath, [simple]);
+  var server = require('../http_simple.js');
   setTimeout(function() {
     var path = '/' + conf.type + '/' + conf.length; //+ '/' + conf.chunks;
     var args = ['-r', 5000, '-t', 8, '-c', conf.c];
 
     bench.http(path, args, function() {
-      server.kill();
+      server.close();
     });
   }, 2000);
 }
index 54500b4..36800f2 100644 (file)
@@ -22,7 +22,7 @@ if (useDomains) {
   gdom.enter();
 }
 
-var server = http.createServer(function (req, res) {
+var server = module.exports = http.createServer(function (req, res) {
   if (useDomains) {
     var dom = domain.create();
     dom.add(req);