1.0.21 • Published 7 years ago

hrtime-measure v1.0.21

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

hrtime-measure NPM version

NPM

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.

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago