Calculating kernel/user/idle time

Peter Steele psteele at
Sat Mar 6 06:21:12 UTC 2010

>They shouldn't need to be massaged.  Just sample the values at two intervals, and your percentages can be calculated by dividing
>each delta by the sum of the deltas (since the sum equals the total CPU usage over the interval, by definition).  If you want to
>calculate per-cpu usage, use the kern.cp_times sysctl instead.

That's the detail I was missing, needing to take two samples. That should solve the problem I was having. Thanks.

More information about the freebsd-questions mailing list