From 6dda36af17a1647bae37f9be910467eccaeed3f3 Mon Sep 17 00:00:00 2001 From: Myrotvorets Date: Sat, 14 Oct 2023 18:05:55 +0300 Subject: [PATCH] Bug fix --- src/processmetrics.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/processmetrics.mts b/src/processmetrics.mts index a46163d..5852dc5 100644 --- a/src/processmetrics.mts +++ b/src/processmetrics.mts @@ -95,7 +95,7 @@ export async function initProcessMetrics(): Promise { observer.observe(cpuTime, usage.systemCPUTime / 1e6, { state: 'system' }); // cpuUsage is in microseconds, hrtime is in nanoseconds - const elapsedUs = Number((observationTime - lastObservationTime) * 1000n); + const elapsedUs = Number((observationTime - lastObservationTime) / 1000n); observer.observe(cpuUtilization, (usage.userCPUTime - lastUsage.userCPUTime) / elapsedUs / cpuCount, { state: 'user', });