http.createServer(onRequest)
我使用并希望测量做出响应所需的时间来创建一个 http 服务器。
目前,在我的onRequest
处理程序中,我这样做:
var start = process.hrtime();
response.on('end', function (){
console.log('time to respond', process.hrtime(start));
});
// call various asynchronous functions and send them 'response' object. One of them eventually does response.end()
我担心当一堆请求立即出现时这是否会正常工作,或者异步会破坏它/混淆时间?