In writing a java version of mpstat, I used the current mpstat code as
a base - not
as code, but to get the list of kstats I needed.

For the time breakdown, I used cpu::sys:cpu_ticks_user and hardcoded the clock
tick rather than calling sysconf(_SC_CLK_TCK).

This is clearly undesirable, but actually led me to a couple of thoughts.

The first was to wonder whether the sysconf data should be exposed as a
kstat. This might actually be quite convenient, although IIRC there are some
values that are dynamic and would be difficult.

But then I looked a bit closer and now I wonder why cpu::sys:cpu_ticks_user
is used at all, when cpu::sys:cpu_nsec_user is available, is presumably
more accurate, and avoids all this messing around with having to convert
based on the tick rate.

Is there any reason why mpstat doesn't use the nsec values?

--
-Peter Tribble
http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/

Reply via email to