Hi All,

We're trying to work out why mpstat and "ps -opcpu" gives some very
different results. The server we're looking at is a zone, when we do
something like "ps -ef -o pcpu | awk '{t+=$1} END {print t}'" and
compare it to "mpstat 1", they're very different. Here is one sample

# ps -ef -o pcpu | awk '{t+=$1} END {print t}'

# mpstat 2
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
  0 6566   0 1958   427   43 1650  310  197   98    0 17080   40  43  
0  16
  1 7424   0 1718  1669 1337 1784  356  197  112    0 15446   44  43  
0  14

Output from ps is saying 10% of CPU is used, whereas mpstat is saying
15% CPU are idle. The figures are almost the inverse of each other.

This is done on two seperate terminals at the same time. The man page of
ps on pcpu says:

The ratio of CPU time used  recently  to CPU  time  available in the
same period, expressed as a percentage.  The  meaning of   ``recently'' 
in  this  context  is unspecified. The CPU time  available  is
determined in an unspecified manner.

Does that mean pcpu is just some random numbers?! 

I had a quick look at the code in ps.c, looks like it's getting it from
/proc into struct psinfo, but how are the values in psinfo calculated?

Is mpstat zone aware or is it just reporting the stats from the global

Any pointers?


zones-discuss mailing list

Reply via email to