Accuracy/reliability of "top" CPU usage numbers
walter harms
wharms at bfs.de
Fri Nov 14 16:09:47 UTC 2014
Am 13.11.2014 16:17, schrieb Grant Edwards:
> How accurate/reliable are the cpu usage numbers shown by busybox "top"
> for long-running multi-threaded processes?
>
> Are they simply extract and shown as-is from /proc/<pid>/<whatever>,
> or is the top code actually doing something?
>
> If it's the former, this is probably off-topic for the busybox
> list...
>
> I'm working on performance issues for a smallish daemon which uses a
> timerfd to trigger periodic polls of some custom hardware (the
> hardware is mapped into userspace), and when it sees changes in input
> values it distributes those new values to some client apps via Unix
> domain sockets. [I've acually commented out the actual socket data
> read/write code, so that isn't even happening.] The polling thread
> runs with a high real time priority (Posix FIFO scheduler, priority=99).
>
> I'm using busybox "top" (on an Atmel ATM9 w/ kernel 2.6.33.7 with
> PREEMPT enable) to see how much CPU the daemon is using.
>
> What's puzzling me is that the CPU usage show by "top" varies wildly
> depending on the frequency at which set the timerfd for polling the
> hardware. For example:
>
> Poll Time (ms) CPU usage (%)
> 20.8 5
> 20.0 16
> 16.8 3
> 14.8 4
> 12.0 3
> 10.8 4
> 10.0 20
> 9.6 3
> 8.8 3
> 6.8 4
> 5.0 5
> 4.0 5
>
Hi grant,
the values for 10,20 look strange the rest is more or less in line.
can you please check von 30,40 also ? (perhaps +-1)
IMHO the values of top are an estimate and it is highly recommended
to do something like you have done a take a time series to find a trend
instead of a "real" value.
re,
wh
> These CPU usage numbers are pretty stable and repeatable (they don't
> vary over time or between runs by more than 1).
>
> Is my app really using 6X as much CPU when polling at 10.0ms as it is
> when polling at 10.8ms or 9.6ms? Or am I running into some sort of
> issue with sampling/aliasing and they way CPU usage is measured?
>
More information about the busybox
mailing list