I’ve just got a quick question, I’m trying to make a status command, and I’m stuck on displaying the CPU usage.
I’ve currently got this,
process.cpuUsage().system but it just gives me a number that means nothing, how would I get the total “CPU capacity” and then convert it into a percentage.
Hi, I think you might find this script useful:
Or this file on github.
That’s cool, but is there a shorter way of doing that? That also uses a lot of the cpu.
You must have an extremely bad CPU if that uses a lot of processing power for you. This is very basic processing for a CPU to do.
You can use
require("os").cpu() to get the average CPU used since node started running.
Well I’m using the glitch cpu, I removed the setInterval() and it’s working fine, thanks!