Take the 2-minute tour ×

As i'm looking at htop and top i see that my processor usage is 100% allways. But i can not see any process that is using that much CPU. Htop shows me only 1-2 processes that use around 5% cpu time.

Is there a way to find the processes that use that much cpu time?

Here is the output of ps -eo pcpu,pid,user,args | sort -r -k1 | less

 0.8 20413 root     jsvc.exec -user tomcat -cp ./bootstrap.jar -Djava.endorsed.dirs=../common/endorsed -outfile ../logs/catalina.out -errfile ../logs/catalina.err -verbose org.apache.catalina.startup.Bootstrap -security  
 0.3   631 mysql    /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/mysql.pid --skip-external-locking  
 0.2  3380 root     /usr/local/apache/bin/httpd -k restart -DSSL  
 0.2 24698 root     tailwatchd  
 0.2 22472 root     /usr/local/jdk/bin/java -Djava.util.logging.config.file=/usr/local/jakarta/tomcat/conf/logging.properties -Dfile.encoding=UTF8 -XX:MaxPermSize=128m -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/jakarta/tomcat/common/endorsed -classpath /usr/local/jakarta/tomcat/bin/bootstrap.jar -Dcatalina.base=/usr/local/jakarta/tomcat -Dcatalina.home=/usr/local/jakarta/tomcat -Djava.io.tmpdir=/usr/local/jakarta/tomcat/temp org.apache.catalina.startup.Bootstrap start  
 0.1 32095 root     cpanellogd - processing bandwidth  
 0.0  9733 root     sleep 1m  
share|improve this question
Could you provide a cut&paste or window capture of the htop output you're seeing? Best if it's sorted by 'CPU Usage' (press 'P'). Thanks. –  lornix Jul 8 '12 at 13:14

1 Answer 1

up vote 2 down vote accepted

pcpu doesn't do what you think.

From UNIX man pages : ps ():


                process has been running (cputime/realtime ratio),
                expressed as a percentage. It will not add up to 100%
                unless you are lucky. (alias pcpu).

As you can see, pcpu doesn't measure the current CPU usage, but the average CPU usage since the process started. If a process has been running for a couple of days before it suddenly misbehaves, you won't be able to see that variation using the ps command.

In contrast, top shows the current CPU usage in the %CPU column.

From UNIX man pages : top ():

k: %CPU  --  CPU usage
   The  task's  share  of  the  elapsed CPU time since the last screen
   of  CPUs.   You toggle 'Irix/Solaris' modes with the 'I' interactive

top automatically sorts processes by current CPU usage, so the first process should be the culprit.

share|improve this answer
hi, on pastebin.com/icvhUCcJ you can find output of my top command on server... i can see only 6 processes (it varies of course) that use around 4% CPU... where is the culprit? :D –  Gabriel Jul 9 '12 at 11:52
In you paste, only 3.3% of your CPU usage corresponds to CPU time spent in user processes (us), which explains why you can't find a process with elevated CPU usage. However, 38.8% corresponds to CPU time spent on system/kernel processes (sy) and 57.9% to CPU time spent on nice processes (ni). There might be a problem with the kernel. Try upgrading it. –  Dennis Jul 9 '12 at 13:11
i just thought that it would show up somewhere, like the kernel would have a generic process. And thanks for the hint to upgrade kernel. i will do that as soon as we will start migrating to new servers. –  Gabriel Jul 9 '12 at 21:03

Your Answer


