Giter Club home page Giter Club logo

node-gcstats's Introduction

GCStats

Build Status Build status

Exposes stats about V8 GC after it has been executed.

Usage

Create a new instance of the module and subscribe to stats-events from that:

var gc = (require('gc-stats'))();

gc.on('stats', function (stats) {
    console.log('GC happened', stats);
});

This will print blobs like this whenever a GC happened:

GC happened {
  startTime: 9426055813976,
  endTime: 9426057735390,
  pause: 1921414,
  pauseMS: 1,
  gctype: 1,
  before: {
     totalHeapSize: 11354112,
     totalHeapExecutableSize: 3670016,
     usedHeapSize: 7457184,
     heapSizeLimit: 1501560832,
     totalPhysicalSize: 9725880,
     totalAvailableSize: 1488434544,
     mallocedMemory: 8192,
     peakMallocedMemory: 1186040
  },
  after: {
     totalHeapSize: 12402688,
     totalHeapExecutableSize: 3670016,
     usedHeapSize: 6485792,
     heapSizeLimit: 1501560832,
     totalPhysicalSize: 10166144,
     totalAvailableSize: 1489388528,
     mallocedMemory: 8192,
     peakMallocedMemory: 1186040
  },
  diff: {
     totalHeapSize: 1048576,
     totalHeapExecutableSize: 0,
     usedHeapSize: -971392,
     heapSizeLimit: 0,
     totalPhysicalSize: 440264,
     totalAvailableSize: 953984,
     mallocedMemory: 0,
     peakMallocedMemory: 0
  }
}

Property insights

  • totalHeapSize: Number of bytes V8 has allocated for the heap. This can grow if usedHeap needs more.
  • usedHeapSize: Number of bytes in use by application data
  • total HeapExecutableSize: Number of bytes for compiled bytecode and JITed code
  • heapSizeLimit: The absolute limit the heap cannot exceed
  • totalPhysicalSize: Committed size (node 0.11+)
  • totalAvailableSize: Available heap size(node 4+)
  • startTime: Nanoseconds for start, using hrtime()
  • endTime: Nanoseconds for end, using hrtime()
  • pause: Nanoseconds from start to end of GC using hrtime()
  • pauseMS: pause expressed in milliseconds
  • gctype can have the following values(v8 source):
    • 1: Scavenge (minor GC)
    • 2: Mark/Sweep/Compact (major GC)
    • 4: Incremental marking
    • 8: Weak/Phantom callback processing
    • 15: All

Installation

npm install gc-stats

Node version support

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

node-gcstats's People

Contributors

dainis avatar andrewdeandrade avatar bripkens avatar advait avatar andreasmadsen avatar kkoopa avatar yelworc avatar msiebuhr avatar rragan avatar

Watchers

Daniel Rinehart avatar Devon Ray Williams avatar James Cloos avatar  avatar Ben Chambers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.