bripkens / gcstats.js

Exposes stats about V8 GC after it has been executed.
MIT License
0 stars 0 forks source link

gcstats.js   Build Status Dependency Status npm version

Exposes statistics about V8 garbage collections (GCs) after they have been executed.


Installation

npm install --save gcstats.js

Usage

Require the module and subscribe to the stats event:

var gcStats = require('gcstats.js');

gcStats.on('stats', function(stats) {
  console.log(stats);
});

This will print blobs like this whenever a GC happens:

{
  "start": 271925068593439,
  "end": 271925070343402,
  "gctype": 1,
  "before": {
    "totalHeapSize": 10481664,
    "totalHeapExecutableSize": 5242880,
    "usedHeapSize": 5761048,
    "heapSizeLimit": 1535115264,
    "totalPhysicalSize": 10481664
  },
  "after": {
    "totalHeapSize": 11530240,
    "totalHeapExecutableSize": 5242880,
    "usedHeapSize": 5512464,
    "heapSizeLimit": 1535115264,
    "totalPhysicalSize": 11530240
  }
}

Property Insights

Node Version Compatibility

GC stats depend on C++ extensions which are compiled when the gcstats.js module is installed. Compatibility information can be inspected via the Travis-CI build jobs.

Credits

node-gcstats was written by @dainis and later adapted by @bripkens and renamed to gcstats.js.