feat: initial node groups #44

Merged
max merged 44 commits from feat/group-node-own into main 2026-05-05 22:08:18 +02:00
Showing only changes of commit db5ee8ba29 - Show all commits
+6 -13
View File
@@ -22,22 +22,15 @@ export async function readCpuSnapshot(): Promise<CpuSnapshot> {
const stat = await readFile('/proc/stat', 'utf8'); const stat = await readFile('/proc/stat', 'utf8');
const line = stat.split('\n')[0]; const line = stat.split('\n')[0];
const parts = line const parts: number[] = line
.trim() .trim()
.split(/\s+/) .split(/\s+/)
.slice(1) .slice(1)
.map(v => Number(v)); .map((v: unknown) => Number(v));
const [ const idle = parts[3];
user, const iowait = parts[4];
nice, const steal = parts[7];
system,
idle,
iowait,
irq,
softirq,
steal
] = parts;
return { return {
idle: idle + iowait, idle: idle + iowait,
@@ -74,7 +67,7 @@ export async function readCgroupCpuStat() {
for (const path of possiblePaths) { for (const path of possiblePaths) {
try { try {
const txt = await readFile(path, 'utf8'); const txt: string = await readFile(path, 'utf8');
return Object.fromEntries( return Object.fromEntries(
txt txt