time-profile
Measuring execution time of functions
A Tool to help you to measure execution time of functions.
Install
$ npm install time-profile
Usage
const timeProfile = ; const profiler = timeProfile; profilerstart'app launch';// ... do work profilerstart'load plugins';// ... load pluginsprofiler; profilerstart'load services';// ... load servicesprofiler; profilerstart'init';// ... initprofiler; // ...profiler; // in the end, you can dump the profile data to a jsonconst json = profiler; // [ Entry { name, start, end, duration, pid }, ... ] // also you can print the profile timelineconsole; // you shoud destroy it when it's not needed anymoreprofiler;
this is timeline:▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ [172ms] - app launch ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ [91ms] - load plugins ▇▇▇▇▇▇▇▇▇▇▇▇▇ [47ms] - load services ▇▇▇▇▇▇▇▇▇▇▇ [41ms] - init