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 os from "node:os";
|
||||||
import EventEmitter from "node:events";
|
import EventEmitter from "node:events";
|
||||||
import { cpus } from "node:os";
|
|
||||||
|
|
||||||
export interface SystemStatus {
|
export interface SystemStatus {
|
||||||
cpu: {
|
cpu: {
|
||||||
@@ -39,7 +38,7 @@ export class StatusHelper {
|
|||||||
usage: ((active / total) * 100).toFixed(2),
|
usage: ((active / total) * 100).toFixed(2),
|
||||||
model: os.cpus()[0].model,
|
model: os.cpus()[0].model,
|
||||||
speed: os.cpus()[0].speed,
|
speed: os.cpus()[0].speed,
|
||||||
core: cpus().length
|
core: os.cpus().length
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ export class StatusHelper {
|
|||||||
private qqUsage() {
|
private qqUsage() {
|
||||||
const mem = process.memoryUsage();
|
const mem = process.memoryUsage();
|
||||||
console.log(JSON.stringify(mem));
|
console.log(JSON.stringify(mem));
|
||||||
const numCpus = cpus().length;
|
const numCpus = os.cpus().length;
|
||||||
const usageDiff = process.cpuUsage(this.currentUsage);
|
const usageDiff = process.cpuUsage(this.currentUsage);
|
||||||
const endTime = process.hrtime(this.currentTime);
|
const endTime = process.hrtime(this.currentTime);
|
||||||
this.currentUsage = process.cpuUsage();
|
this.currentUsage = process.cpuUsage();
|
||||||
|
Reference in New Issue
Block a user