2017-03-01 18:32:21 -06:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const log = require('./log.js');
|
2017-08-24 02:51:02 -05:00
|
|
|
const logLevels = require('./enums/logLevels.js');
|
2017-03-01 18:32:21 -06:00
|
|
|
|
|
|
|
// once a minute
|
|
|
|
setInterval(gatherMemory, 1000 * 60);
|
|
|
|
|
2017-08-24 05:48:32 -05:00
|
|
|
/**
|
|
|
|
* Gathers system memory and logs it to the remote system
|
|
|
|
*/
|
2017-03-01 18:32:21 -06:00
|
|
|
function gatherMemory() {
|
2017-08-24 02:51:02 -05:00
|
|
|
let memory = process.getProcessMemoryInfo();
|
|
|
|
let details =
|
2017-03-01 18:32:21 -06:00
|
|
|
'workingSetSize: ' + memory.workingSetSize +
|
|
|
|
' peakWorkingSetSize: ' + memory.peakWorkingSetSize +
|
|
|
|
' privatesBytes: ' + memory.privatesBytes +
|
|
|
|
' sharedBytes: ' + memory.sharedBytes;
|
|
|
|
log.send(logLevels.INFO, details);
|
|
|
|
}
|