In my Ubuntu 12.04, with psensor, I saw a percentage number updated for cpu usage. I wonder how this percentage caculated? Specifically, what is the numerator and denominator in the ratio?
Thanks!
cpuUbuntu
In my Ubuntu 12.04, with psensor, I saw a percentage number updated for cpu usage. I wonder how this percentage caculated? Specifically, what is the numerator and denominator in the ratio?
Thanks!
Best Answer
The processor usage percent is calculated with "the amount of time that the processor is not on idle". I mean, this calc is made from a counter that register the usage of the "idle" running process. While another preocesses "rob" the processor power from the idle process, the idle processor consumer register is decreased by a factor; as the time line is fixed and constant, the (1-"%time in the idle taks") is the amount of processor load used for all processes running on a processor:
Defining CPU utilization
Listing 1: Simple example of a background loop