Added table for memory usage

This commit is contained in:
xxDeveloper
2022-02-13 22:49:26 +03:00
parent eaba125ce0
commit c3d29f7016

View File

@@ -20,11 +20,26 @@ export default class Logger {
console.log(`[${`${tz}`}][${sEvent[e]}] :: ${message}`);
}
public tableRam() {
/**
* ┌──────────────┬─────────┐
* │ (index) │ Values │
* ├──────────────┼─────────┤
* │ rss │ '50.26' │
* │ heapTotal │ '29.15' │
* │ heapUsed │ '12.62' │
* │ external │ '0.84' │
* │ arrayBuffers │ '0.10' │
* └──────────────┴─────────┘
* This method will print out memory usage. Optional at startup.
*/
public tableRam() {
console.table(
Object.entries(process.memoryUsage())
.map(([k, v] : [string, number]) => { return {[k] : ((Math.round(v) / 1024 / 1024 * 100) / 100).toFixed(2) }})
.map(([k, v]: [string, number]) => {
return { [k]: ((Math.round(v) / 1024 / 1024 * 100) / 100).toFixed(2) };
})
.reduce(((r, c) => Object.assign(r, c)), {})
)
);
}
}
}