mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: system status helper
- remove duplicate os import
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user