This commit is contained in:
赵鑫 2022-09-08 10:14:52 +08:00
parent c5758cafd8
commit b2cbc041d8

View File

@ -33,7 +33,7 @@ function update_status() {
status.memory.available = Number(meminfo_available[1])
status.cpu.temperature = Number(fs.readFileSync(TEMPERATURE_FILE_PATH) / 1000)
exec("cat /proc/stat |grep cpu |tail -1|awk '{print ($5*100)/($2+$3+$4+$5+$6+$7+$8+$9+$10)}'|awk '{print 100 - $1}'", (err, stdout, stderr) => {
status.cpu.load = Number((stdout / 100).toFixed(6))
status.cpu.load = Number(stdout)
status.error = null
io.emit('status', status)
})