"use strict";

var EventEmitter = require('events').EventEmitter;
var GcProfiler = require('./build/Release/GcProfiler');

var main = new EventEmitter();
module.exports = main;

var GC_TYPES = {
	1: 'Scavenge',
	2: 'MarkSweepCompact',
	3: 'All'
};

main.GCCallbackFlags = {
	kNoGCCallbackFlags: 0,
	kGCCallbackFlagCompacted: 1 << 0,
	kGCCallbackFlagConstructRetainedObjectInfos: 1 << 1,
	kGCCallbackFlagForced: 1 << 2
};

GcProfiler.loadProfiler(function (startTime, ms, type, flags)
{
	var info = {
		date: new Date(startTime * 1000),
		duration: ms,
		type: GC_TYPES[type],
		forced: !!(flags && main.GCCallbackFlags.kGCCallbackFlagForced),
		flags: flags
	};
	
	main.emit('gc', info);
});

@@ -171,16 +171,109 @@
  main;%0A%0A
+// https://github.com/v8/v8/blob/ca9ec36eb5881f73c1ac1b5a5df710227ad96fae/include/v8.h#L5228%0A
 var GC_T
@@ -322,17 +322,72 @@
 pact',%0A%09
-3
+4: 'IncrementalMarking',%0A%098: 'ProcessWeakCallbacks',%0A%0915
 : 'All'%0A
@@ -803,17 +803,16 @@
 ags%0A%09%7D;%0A
-%09
 %0A%09main.e

Add more GC types.