node.js - How do I measure the execution time of JavaScript code with callbacks?

preview_player
Показать описание
#short
#javascript
#profiling
for(var i = 1; i LIMIT; i++) {
var user = {
id: i,
name: "MongoUser [" + i + "]"
};
if(err || !saved) {
} else {
}
});
}

How can I measure the time taken by these database insert operations? I could compute the difference of date values after and before this piece of code but that would be incorrect because of the asynchronous nature of the code.
Рекомендации по теме
join shbcf.ru