From e71ccdd12a295e39de0daa71fe533c150200eec3 Mon Sep 17 00:00:00 2001 From: pk5ls20 Date: Sun, 22 Dec 2024 02:55:49 +0800 Subject: [PATCH] feat: system status helper - remove duplicate os import --- src/core/helper/status.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/helper/status.ts b/src/core/helper/status.ts index 54772ff4..c4bca2f2 100644 --- a/src/core/helper/status.ts +++ b/src/core/helper/status.ts @@ -1,6 +1,5 @@ import os from "node:os"; import EventEmitter from "node:events"; -import { cpus } from "node:os"; export interface SystemStatus { cpu: { @@ -39,7 +38,7 @@ export class StatusHelper { usage: ((active / total) * 100).toFixed(2), model: os.cpus()[0].model, speed: os.cpus()[0].speed, - core: cpus().length + core: os.cpus().length }; } @@ -51,7 +50,7 @@ export class StatusHelper { private qqUsage() { const mem = process.memoryUsage(); console.log(JSON.stringify(mem)); - const numCpus = cpus().length; + const numCpus = os.cpus().length; const usageDiff = process.cpuUsage(this.currentUsage); const endTime = process.hrtime(this.currentTime); this.currentUsage = process.cpuUsage();