How to use gc-profiler - 4 common examples

To help you get started, we’ve selected a few gc-profiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dritchie / adnn / test / gc.js View on Github external
var Tensor = require('../THTensor');
//var Tensor = require('../tensor');
var ad = require('../ad');
var nn = require('../nn');
var opt = require('../opt');
var profiler = require('gc-profiler');

//Profile GC
// node --inspect test/gc.js

var numT = 10000;
var sizeT = 1000
console.time('tensor');
profiler.on('gc', function (info) {
  console.log(info);
});
while (numT-- > 0) {
  var t = new Tensor([sizeT,sizeT]).fill(0);
}
console.timeEnd('tensor');
github cjihrig / toolbag / plugins / gc.js View on Github external
function start () {
  if (running) {
    return;
  }

  running = true;
  clearEvents();
  Gc.on('gc', gcEventHandler);
}
github watson / memory-usage / index.js View on Github external
stream.once('resume', function () {
      profiler.on('gc', function (info) {
        gcSample = process.memoryUsage()
        if (opts.ts) gcSample.ts = Date.now()
        gcSample.gc = info.type
      })
    })
  }
github cjihrig / toolbag / plugins / gc.js View on Github external
function stop () {
  if (!running) {
    return;
  }

  running = false;
  clearEvents();
  Gc.removeListener('gc', gcEventHandler);
}

gc-profiler

Allows you to profile when the garbage collector runs, and how long it takes.

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Popular gc-profiler functions