# /proc/stat interpretation

## tnt

I use /proc/stat to monitor CPU activity.

I read 'user', 'nice', 'system', 'iowait', 'irq' and 'softirq' per CPU. I omit 'idle'.

sometimes, I get sum of 'user', 'nice', 'system', 'iowait', 'irq' and 'softirq' bigger then 100% CPU time.

should this be considered as measuring error or CPU can be in more then one 'state' at the same time (for example, both in 'system' and 'iowait') ?

----------

## Bones McCracker

My first question would be, "where are you obtaining your number for what you referred to as '100% CPU time'?"

I'm not absolutely certain on this, but I believe the CPU states are mutually exclusive and collectively exhaustive.  There is documentation of the meaning of these columns in /usr/src/linux/Documentation/filesystems/proc.txt (section 1.8), and in man page PROC(5).  These are the column definitions from the kernel documentation (the tenth column is undocumented in the man page):

 *Quote:*   

> - user: normal processes executing in user mode
> 
> - nice: niced processes executing in user mode
> 
> - system: processes executing in kernel mode
> ...

 

I may be wrong that they are mutually exclusive and collectively exhaustive; I have noticed before that the utilization state percentages shown by the 'top' command generally add up to 100%, but sometimes exceed it (e.g. 100.1%).  I have always just attributed that to rounding error:

```
Cpu(s):  4.3%us,  2.0%sy,  0.0%ni, 93.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
```

----------

## tnt

I use classic rrdtool with cacti "frontend".

----------

## Bones McCracker

 *tnt wrote:*   

> I use classic rrdtool with cacti "frontend".

 

Well, if you're not simply adding up the numbers from the very same read of /proc/stat, the discrepancy might simply be time.

----------

