Displaying CPU usage

Hello everyone!

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.

1 Like

Hi, I think you might find this script useful:

Or this file on github.

1 Like

That’s cool, but is there a shorter way of doing that? That also uses a lot of the cpu.

1 Like

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.

1 Like

Well I’m using the glitch cpu, I removed the setInterval() and it’s working fine, thanks!

1 Like