node.js - measure time with node js -
i want send 2000 db requests via node end measure time of each request. this:
var getkey = function(key, i) { console.time(i); client.getkey(key, function(val) { console.timeend(i); } } for(var = 0; < 2000; ++) { getkey(keys[i], i); }
the problem doesn't measure beacouse of node.it gets start time , waits(because 1 thread) - each measure gets more ms should. how can fix it? i'm bit new nodejs. thanks.
granular performance functionality available process.hrtime()
. tom pawlak has great blog post titled, "how measure execution time in node.js", explains best practices associated measuring execution time of node.js code:
process.hrtime() function returns high-resolution real time in [seconds, nanoseconds] array.
please let me know if have questions!
Comments
Post a Comment