UNPKG

yunzai-micro-plugin

Version:

Yunzai开发管理面板

26 lines (23 loc) 730 B
import { si } from './utils.js'; async function getCpuInfo() { let { currentLoad: { currentLoad }, cpu, fullLoad } = await si.get({ currentLoad: "currentLoad", cpu: "manufacturer,speed,cores", fullLoad: "*" }); let { manufacturer, speed, cores } = cpu; if (currentLoad == null || currentLoad == undefined) return false; fullLoad = Math.round(fullLoad); manufacturer = manufacturer?.split(" ")?.[0] ?? "unknown"; return { inner: Math.round(currentLoad) / 100, title: "CPU", info: [ `${manufacturer}`, `${cores}${speed}GHz`, `CPU满载率 ${fullLoad}%` ] }; } export { getCpuInfo as default };