different process's %cpu output via top from busybox and procps-ng
I have an
Embedded Linux(Kernel 2.6.37) running on
ARM. There's a default
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
top output from
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
procps-ng top and
busybox top are the same.
Then I read the calculation source code of
procps-ng. I found that they really have different calculation formula for one process's
- 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
Why the two projects choose different calculation formula? Do they designed for different application case? Thanks!