hrtime-measure v1.0.21
hrtime-measure 
This module measures the execution time of javascript operations.
Example
This example starts the measurement in the app.js file.
const measure = require('hrtime-measure');
// start measurement
measure.start('AnyName');
And continues the measurement in the middleware.js file.
const measure = require('hrtime-measure');
// set the steps by measure name and step title.
measure.step('AnyName', 'app.js:http_io');
measure.step('AnyName', 'app.js:middleware()');
measure.step('AnyName', 'middleware.js:initNumeral');
// stop measurement measure name.
measure.end('AnyName', 'middleware.js:end', true);
Console Output
Total execution time "AnyName": ~ 0s 83.52 ms
1. 0s 0.09 ms app.js:http_io
2. 0s 13.13 ms app.js:middleware()
3. 0s 70.11 ms middleware.js:initNumeral
4. 0s 0.19 ms middleware.js:return
Group Steps
const measure = require('hrtime-measure', true);
// start measurement
measure.start('AnyName');
measure.step('AnyName', 'prepare loop');
measure.step('AnyName', 'loop');
measure.step('AnyName', 'loop');
measure.end('AnyName', 'end loop', true);
Console Output
Total execution time "AnyName": ~ 0s 83.52 ms
1. 0s 0.09 ms prepare loop
2. 0s 70.13 ms loop
3. 0s 13.11 ms end loop
Install
npm install hrtime-measure --save
API
start(label)
Start the measurement and give the name for the new timer. This will identify the timer; use the same name when calling measure.end() to stop the timer.
step(label,title)
Step set a timesplit by label
with any optional title
.
end(label,title,print)
Stop the measurement and return the ouput as a string. If the optional parameter print
is set to true, the time will output to the console.
disable()
With this function, the measurement can be turned off in production.
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago