mirror of
https://github.com/UiO-Gaming/infoscreen3.git
synced 2026-11-05 13:56:52 +01:00
- Updated package.json to replace pkg with nexe for building executables. - Added rebuild-native-node20.js for rebuilding native modules for Node.js 20.18.1. - Introduced test-exe.js to facilitate testing of the generated executable. - Modified webpack.config.cjs to output bundle.cjs and set libraryTarget to commonjs2. - Enhanced profiler plugin for memory usage tracking with simplified output. - Removed unused dependencies and updated existing ones in package.json.
29 lines
895 B
JavaScript
29 lines
895 B
JavaScript
import plugin from "../../modules/plugin.js";
|
|
import cli from "../../modules/cli.js";
|
|
|
|
let prevValue = 0;
|
|
let startValue = (process.memoryUsage().rss / 1048576).toFixed(1);
|
|
|
|
function tickHeapDump() {
|
|
setImmediate(function () {
|
|
let memMB = (process.memoryUsage().rss / 1048576).toFixed(1);
|
|
if (prevValue != memMB) {
|
|
let prefix = "▲";
|
|
if (memMB < prevValue) {
|
|
prefix = "▼";
|
|
}
|
|
cli.info("Memory: " + prefix + " " + (memMB - prevValue).toFixed(1) + 'Mb' + " start: " + startValue + "Mb now: " + memMB + "Mb (" + (memMB - startValue).toFixed(1) + "Mb)");
|
|
prevValue = memMB;
|
|
}
|
|
});
|
|
}
|
|
|
|
export default class profilerPlugin extends plugin {
|
|
onInit() {
|
|
tickHeapDump();
|
|
setInterval(() => {
|
|
tickHeapDump();
|
|
}, 5000);
|
|
}
|
|
}
|