performance-nodejs

Get nodejs performance, such as: heap statistics, event loop delay
Installation
$ npm i performance-nodejs
Examples
View the ./examples directory for working examples.
Description
The performance()
function get node.js performance (include event loop and heap statistics).
const timer = performance(fn, interval);
-
fn: The callback function to execute.
-
interval: Check interval, defaulted to 100ms.
-
unit: Set the heap format unit, eg: 'B', 'MB', 'GB', '0.0MB' defaulted to 'B'. 0.00MB
means set 2 precision and 'MB' unit.
Returns: A reference to the timer. Useful for clearing the timer.
malloced_memory
, peak_malloced_memory
and does_zap_garbage
is new in node.js v7.x
performance(data => {
// {"lag":3,"heap":{"total_heap_size":22,"total_heap_size_executable":6,"total_physical_size":22,"total_available_size":1407,"used_heap_size":15,"heap_size_limit":1432,"malloced_memory":0,"peak_malloced_memory":2,"does_zap_garbage":0}}
console.info(JSON.stringify(data));
}, 'MB', 100);
License
MIT