On a Unix or Unix-like system, how do I view the percent CPU usage per process, split into user and system and other time categories? top
shows me overall "sy", "us", "wa", etc for the entire computer or per core, but I don't see anything in the manual showing how to show those stats per process.
To illustrate…
top shows something like this:
top - 18:11:58 up 9 days, 6:41, 17 users, load average: 2.42, 2.38, 2.47
Tasks: 2642 total, 4 running, 2638 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.9 us, 0.8 sy, 0.0 ni, 96.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 26413387+total, 26355763+used, 576240 free, 233544 buffers
KiB Swap: 8921084 total, 8920140 used, 944 free. 14931166+cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
63209 postgres 20 0 0.101t 0.012t 0.012t R 100.0 5.0 389:44.92 postgres
62356 postgres 20 0 0.101t 922336 886508 R 100.0 0.3 10:25.82 postgres
2139 rabbitmq 20 0 9817.9m 5.334g 2968 S 10.4 2.1 1848:43 beam.
For example, I'd like to see something like this (see %CPU(sy) and %CPU(us)):
top - 18:11:58 up 9 days, 6:41, 17 users, load average: 2.42, 2.38, 2.47
Tasks: 2642 total, 4 running, 2638 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.9 us, 0.8 sy, 0.0 ni, 96.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 26413387+total, 26355763+used, 576240 free, 233544 buffers
KiB Swap: 8921084 total, 8920140 used, 944 free. 14931166+cached Mem
PID USER PR NI VIRT RES SHR S %CPU(us) %CPU(sy) %MEM TIME+ COMMAND
63209 postgres 20 0 0.101t 0.012t 0.012t R 100.0 1.0 5.0 389:44.92 postgres
62356 postgres 20 0 0.101t 922336 886508 R 100.0 0.4 0.3 10:25.82 postgres
2139 rabbitmq 20 0 9817.9m 5.334g 2968 S 10.4 0.2 2.1 1848:43 beam.
Best Answer
you can have the statistics you want about a process by using this Command:
for example