prstat:
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/
NLWP
4038 root 196M 191M run 59 0 11:40:55 0.8% java/85
top:
PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND
4038 root 88 59 0 196M 191M sleep 700:55 2.13% java
I'm a bit confused witch ot this tool is the best to monitor CPU
usage.
is there anyone that can explain this difference ?
Kindly Regards Blodstrupmoen
Top reports usage per CPU, whereas prstat reports usage of the entire
machine. So for example if you have 4 CPUs in your server, and you
run a single-threaded process that is burning up an entire CPU, top
will report "100%" for that process, whereas prstat will show "25%".
A multi-threaded process that uses up all 4 cores will show nearly
100% in prstat. I'm not sure what top would look like in that
situation.
Brendan Gregg compared these tools back in 2005:
http://www.brendangregg.com/DTrace/prstatvstop.html
I don't know if his (extensive) comments still apply...
Thanks,
Cindy
They are still valid, but not in the context of the OP's question.
His article excellently explains how top and prstat operate, but they
don't provide a definition of top's cpu metric.