add heap and processMemory Info stats

This commit is contained in:
Abhinav 2022-11-17 15:24:36 +05:30
parent 1cbd046af3
commit 16c3fbf2f9

View file

@ -1,23 +1,32 @@
import ElectronLog from 'electron-log';
import { webFrame } from 'electron/renderer';
const FIVE_MINUTES_IN_MICROSECONDS = 5 * 60 * 1000;
const FIVE_MINUTES_IN_MICROSECONDS = 30 * 1000;
async function logMainProcessStats() {
const systemMemoryInfo = process.getSystemMemoryInfo();
const cpuUsage = process.getCPUUsage();
const processMemoryInfo = await process.getProcessMemoryInfo();
const heapStatistics = process.getHeapStatistics();
ElectronLog.log('main process stats', {
systemMemoryInfo,
cpuUsage,
processMemoryInfo,
heapStatistics,
});
}
async function logRendererProcessStats() {
const blinkMemoryInfo = process.getBlinkMemoryInfo();
const heapStatistics = process.getHeapStatistics();
const processMemoryInfo = process.getProcessMemoryInfo();
const webFrameResourceUsage = webFrame.getResourceUsage();
ElectronLog.log('renderer process stats', {
blinkMemoryInfo,
heapStatistics,
processMemoryInfo,
webFrameResourceUsage,
});
}