I use Ubuntu 12.04.1 Linux. I see a difference between
C output format of
ps command for a process. It is not clearly noted in the
ps man page.
Man pages says:
CODE HEADER DESCRIPTION %cpu %CPU cpu utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage. It will not add up to 100% unless you are lucky. (alias pcpu). c C processor utilization. Currently, this is the integer value of the percent usage over the lifetime of the process. (see %cpu).
So basically it should be the same, but it is not:
$ ps aux | head -1 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND $ ps aux | grep 32473 user 32473 151 38.4 18338028 6305416 ? Sl Feb21 28289:48 ZServer -server -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./log $ ps -ef | head -1 UID PID PPID C STIME TTY TIME CMD $ ps -ef | grep 32473 user 32473 32472 99 Feb21 ? 19-15:29:50 ZServer -server -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./log
The top shows 2% CPU utilization in the same time. I know the 'top' shows the current CPU utilization while
ps shows CPU utilization over the lifetime of the process.
I guess the lifetime definition is somewhat different for these two format options.