Hello everyone,

I have an `Embedded Linux(Kernel 2.6.37)` running on `ARM`. There's a
default `top` from `busybox 1.13.2`. And I build a `procps-ng 3.3.11` via
cross compile to run on this `Linux`. I found that the process's `%cpu` via
`top` output from `busybox` and `procps-ng` are different.

For example,  the `%cpu` of one process, `procps-ng top` display about 30%,
but `busybox top` display only about 10%. The total `%cpu` from `procps-ng
top` and `busybox top` are the same.
Then I read the calculation source code of `busybox` and `procps-ng`. I
found that they really have different calculation formula for one process's
`%cpu`.

<pre><code>
- busybox top:
    CPU% = s->pcpu/sum(s->pcpu) * busy_cpu_ticks/total_cpu_ticks
    (pcpu is delta of sys+user time between samples)

- procps-ng top:
    CPU% = s->pcpu/total_cpu_ticks
</code></pre>

Why the two projects choose different calculation formula? Do they designed
for different application case?


Looking forward to your reply.
Thanks very much!
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to