Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Top and Prstat display different results for CPU

631 views
Skip to first unread message

Blodstrupmoen

unread,
Jul 14, 2011, 6:29:10 AM7/14/11
to
When i compare prstat and top result for the same machine, then i can
see there is an big difference in CPU usage.

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

Jim Leonard

unread,
Jul 14, 2011, 12:56:51 PM7/14/11
to

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.

cindy

unread,
Jul 14, 2011, 3:57:01 PM7/14/11
to

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

Jim Leonard

unread,
Jul 15, 2011, 10:51:04 AM7/15/11
to
On Jul 14, 2:57 pm, cindy <cindy.swearin...@oracle.com> wrote:
> 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...

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.

0 new messages