Time web requests in node.js

Given Node's async nature it is difficult to time a series of web requests. How would I fire off 100 webrequests and figure out how long each individual request takes? Knowing the OS will only allow a few concurrent web request, how do I get the timeing for each individual webrequest, removing the time spent waiting for the other connections to complete. I was hoping the socket event was fired when the request launched but it seems that the socket event is fired after the connection has been established.

var http = require('http');

var urls = [
    '/cameron',
    '/sara',
    '...',


// Time a url collection.
function timeUrl(url, calback) {
    var options = {  
        host: 'www.examplesite.com',   
        port: 80,   
        path: ''  
    };      
    var times = [];
    times.push({'text': 'start', 'time':Date.now()});

    http.get(options, function(res) {
        times.push({'text': 'response', 'time':Date.now()});    

        var result = '';        
        res.on('data', function(chunk) {  
            result += chunk.length ;
            // result += chunk;        
        });   
        res.on('end', function() {  
            times.push({'text': 'end', 'time': Date.now(), 'body': result, 'statusCode': res.statusCode}); // ,   
            calback(times);
        });
    }).on('error', function(e) {  
        calback();
        console.log("Got error: " + e.message);
        times.push({'error':Date.now()});
    }).on('socket', function (response) {
         times.push({'text': 'socket', 'time':Date.now()});
    });
}
for (var i = 0; i < urls.length; i++) {
    var url = urls[i];
    timeUrl(url, function(times) {
        console.log(url);
        for (var i = 0; i < times.length; i++) {
            console.log(times[i].text, times[i].time - times[1].time , 'ms');
        }
        console.log('statusCode:', times[times.length -1].statusCode, 'Response Size:', times[times.length -1].body);   
         console.log('-');
    });
}

For ease of use, doing what you seem to want to do, I've not seen anything beat Nodetime.

If you're worried about OS concurrency just introduce maximum concurrency (throttling) into your requests instead of trying to guess when exactly the OS has started. I'm skipping over some minor details like error handling and using the excellent async.js library:

var http  = require('http')
  , async = require('async')
  , CONCURRENCY = 5 // edit to fit your OS concurrency limit
  , results = {}
  , urls = [
    '/cameron',
    '/sara',
    '/...'
];

// Time a url collection.
function timeUrl(url, callback) {
    var options = { host: 'www.examplesite.com', port: 80 }
      , start = Date.now()
      , socket = null;
    options.path = url;

    http.get(options, function(res) {
      var response = Date.now()
        , size = 0;
        res.on('data', function(chunk) { size += chunk.length; });   
        res.on('end',  function() {
          var end = Date.now();
          results[url] = { start: start, socket: socket, response: response, end: end, size: size };
          callback();
        });
    }).on('error', function(e) {
      results[url] = { start: start, socket: socket, error: Date.now(), stack: e };
      callback();
    }).on('socket', function () {
      socket = Date.now();
    });
}

async.forEachLimit(urls, CONCURRENCY, timeUrl, function() {
  console.log(JSON.stringify(results));
});