Add startedAtMs to all processes

This commit is contained in:
Cooldude2606 committed 2026-02-01 21:30:00 +00:00
1 parent a4e4621eaa
commit 9729743a29
12 files changed
+118 -9

No files matched your search

+10 -2
View File
@@ -134,7 +134,12 @@ function minZip<T>(a: T[], b: T[]): [T, T][] {
let previousTotalCpuMs: number[] = [];
let previousIdleCpuMs: number[] = [];
export async function gatherSystemInfo(id: SystemInfo["id"], canRestart: boolean, restartRequired: boolean) {
export async function gatherSystemInfo(
id: SystemInfo["id"],
canRestart: boolean,
restartRequired: boolean,
startedAtMs: number
) {
const cpus = os.cpus();
const currentTotalCpuMs = cpus.map(({ times }) => times.user + times.idle + times.irq + times.nice + times.sys);
const currentIdleCpuMs = cpus.map(({ times }) => times.idle);
@@ -152,6 +157,7 @@ export async function gatherSystemInfo(id: SystemInfo["id"], canRestart: boolean
diskAvailable = stats.bavail * stats.bsize;
}
const now = Date.now();
return new SystemInfo(
id,
os.hostname(),
@@ -166,7 +172,9 @@ export async function gatherSystemInfo(id: SystemInfo["id"], canRestart: boolean
diskAvailable,
canRestart,
restartRequired,
Date.now(),
now - (os.uptime() * 1000),
startedAtMs,
now,
false,
);
}