# top and reported user cpu usage.



## chrcol (Jan 21, 2011)

simple question, how is the user% calculated in top? I always assumed it was how much cpu % the processes were using but I have a server that is reporting 40-60% user cpu usage yet the processes added up are not even using 10%.


----------



## Graaf_van_Vlaanderen (Jan 23, 2011)

The computer load is not just determined by the CPU alone, but also by the whole system.
Although the CPU is the heart of the computer, the same machine can be heavily loaded if under relative low CPU loads. For example a file operation can bring the hard disk under heavy load. 
As you can see in 'top', there is not just 'CPU' percentage but also 'system' percentage.


----------



## jalla (Jan 23, 2011)

Graaf_van_Vlaanderen said:
			
		

> The computer load is not just determined by the CPU alone, but also by the whole system.
> Although the CPU is the heart of the computer, the same machine can be heavily loaded if under relative low CPU loads. For example a file operation can bring the hard disk under heavy load.
> As you can see in 'top', there is not just 'CPU' percentage but also 'system' percentage.


Rubbish.

The CPU: summary line show the percentage the cpu has spent in different processor states. If you add them you will get 100%.

OP, post the actual output from top to demonstrate the problem.


----------



## chrcol (Jan 26, 2011)

sorry for my slow reply and yes I am not talking about generic computer load I am talking about specific user% cpu usage.

note about the paste below.

this is done at night when load almost zero so problem not so obvious but can see 3.5% user load and the busiest process at only 0.10%, in the day I will do another paste and that will a very wide gap between user% and process total %.  The system is 7.2 64bit.


```
last pid: 76917;  load averages:  0.57,  0.44,  0.32   up 136+21:00:21 04:01:57
61 processes:  1 running, 60 sleeping
CPU:  [B]3.3% user,[/B]  0.0% nice,  1.5% system,  0.0% interrupt, 95.2% idle
Mem: 262M Active, 6461M Inact, 667M Wired, 211M Cache, 399M Buf, 313M Free
Swap: 8192M Total, 140K Used, 8192M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
  918 root          1  44    0 26472K  7760K select 3 926:56  0.10% snmpd
17505 _sphinx       1  69    0 23132K  3112K select 0 145:00  0.00% searchd
  889 root          1  44    0 10396K  2116K select 1   6:32  0.00% ntpd
  801 bind         11   4    0 36172K 25324K kqread 1   3:20  0.00% named
 1159 root          1  44    0 10600K  2816K select 3   3:10  0.00% sendmail
  724 root          1  44    0  5644K  1032K select 2   3:03  0.00% syslogd
47187 root          1  52    0 13688K  2144K select 2   1:37  0.00% sshd
 1172 root          1   8    0  6704K  1196K nanslp 2   0:41  0.00% cron
68807 root          1  44    0 85244K  6868K select 1   0:34  0.00% httpd
55433 mysql         9  44    0   458M   180M ucond  2   0:09  0.00% mysqld
 1269 user1         1  44    0  8124K  1820K select 6   0:09  0.00% screen
 1165 smmsp         1  20    0 10600K  2560K pause  0   0:03  0.00% sendmail
44844 www           1   4    0 87292K 11264K accept 6   0:02  0.00% httpd
44848 www           1   4    0 87292K 11196K accept 0   0:02  0.00% httpd
44852 www           1   4    0 87292K 11476K accept 0   0:02  0.00% httpd
44854 www           1   4    0 87292K 11076K accept 5   0:02  0.00% httpd
```


----------



## chrcol (Jan 26, 2011)

does this make it more interesting? from the day and with -P on top.


```
last pid:  8840;  load averages:  3.59,  3.43,  3.58   up 137+04:49:17 11:50:53
126 processes: 6 running, 120 sleeping
CPU 0: 51.1% user,  0.0% nice, 14.3% system,  0.0% interrupt, 34.6% idle
CPU 1: 54.9% user,  0.0% nice,  3.8% system,  0.0% interrupt, 41.4% idle
CPU 2: 68.4% user,  0.0% nice, 13.5% system,  0.0% interrupt, 18.0% idle
CPU 3: 13.5% user,  0.0% nice,  6.8% system,  3.0% interrupt, 76.7% idle
CPU 4: 19.4% user,  0.0% nice,  6.7% system,  0.0% interrupt, 73.9% idle
CPU 5: 18.8% user,  0.0% nice,  7.5% system,  0.0% interrupt, 73.7% idle
CPU 6: 20.3% user,  0.0% nice,  3.0% system,  0.0% interrupt, 76.7% idle
CPU 7:  0.7% user,  0.0% nice,  1.5% system,  0.0% interrupt, 97.8% idle
Mem: 437M Active, 5431M Inact, 669M Wired, 291M Cache, 399M Buf, 1087M Free
Swap: 8192M Total, 140K Used, 8192M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
55433 mysql        66  44    0   533M   293M ucond  2   0:10  9.72% mysqld
  918 root          1  44    0 26472K  7760K select 5 929:28  0.00% snmpd
17505 _sphinx       1  96    0 23080K  3112K select 0 147:12  0.00% searchd
  889 root          1  44    0 10396K  2116K select 3   6:33  0.00% ntpd
  801 bind         11   4    0 36172K 25516K kqread 3   3:21  0.00% named
 1159 root          1  44    0 10600K  2816K select 2   3:10  0.00% sendmail
  724 root          1  44    0  5644K  1032K select 7   3:03  0.00% syslogd
47187 root          1  44    0 13688K  2144K select 1   1:37  0.00% sshd
 1172 root          1   8    0  6704K  1196K nanslp 1   0:41  0.00% cron
```


----------



## jalla (Jan 26, 2011)

You can try to toggle the display of system procs ('S') to see if that reveals anything.

Other than that my guess is that your system runs a lot of short-lived processes that aren't cought by top.
As seen by the load average you have a steady queue of processes that wants to run, but none of those displayed are likely candidates.


----------



## chrcol (Jan 26, 2011)

-S doesnt show much in terms of what it is.

It shows cpu idle states going in and out of RUN
various irq stuff in WAIT state.
otherwise nothing else.

I am a bit concerned if the server has processess starting for a split second, using lots of cpu and then stopping again on a repeated basis.


----------



## jalla (Jan 26, 2011)

Just a thought, but you don't run jails by any chance?


----------



## chrcol (Jan 30, 2011)

there is no jails.

is this a concern, ie possible hidden trojan processes?


----------

