export interface ProcessWorkingSetSnapshot { workingSetKb: number | null; } export function sumWorkingSetKb(processes: readonly ProcessWorkingSetSnapshot[]): number | null { let total = 0; let hasAny = false; for (const process of processes) { if (process.workingSetKb == null || process.workingSetKb < 0) { continue; } total += process.workingSetKb; hasAny = true; } return hasAny ? total : null; }