Kill handler to dump mem usage and perf numbers

This commit is contained in:
Jean-Francois 2013-11-22 16:43:44 +01:00
parent 2e10d3d79e
commit efb412f5b8

View File

@ -82,16 +82,21 @@ function dumpResults() {
exports.dumpResults = dumpResults;
function canContinue() {
if (!go) {
dumpResults();
log("Ending...");
forceGC();
var memEnd = captureMemory();
log("Memory after gc \n" + memToString(memEnd));
log("Heap Diff " + diffMemory(memStart, memEnd));
process.exit(0);
doExit();
}
return true;
}
function doExit() {
dumpResults();
log("Ending...");
forceGC();
var memEnd = captureMemory();
log("Memory after gc \n" + memToString(memEnd));
log("Heap Diff " + diffMemory(memStart, memEnd));
process.exit(0);
}
exports.canContinue = canContinue;
function actionStart() {
if(count == 5) {
@ -147,4 +152,7 @@ function run() {
if (canContinue()) {
setImmediate(run);
}
}
}
// Killing the process dumps current status
process.signals.setSignalCallback(doExit);
process.signals.start('SIGINT');