[PATCH] Add (optional) CPU statistics to top

Denis Vlasenko vda.linux at googlemail.com
Thu Jun 14 09:11:03 UTC 2007


On Monday 11 June 2007 09:12, Alex Landau wrote:
> Oh, I forgot to say: if you removed div() from the new code, you should probably remove
> it also from the old one (the calculation of per-process cpu and mem usage), since the
> global calculations are done only once per a refresh, while the per-process are done,
> well..., per-process per refresh.

I removed them too.

Per-process calculations turned out to be actually cheaper codesize-wise
(two of them) as compared to global ones.

"per process per refresh" in practice is limited by the number of _displayed_
processes + anyway most of divisions are really executed by stdio code when
we printf %u stuff.

I wonder, maybe that should be looked at.... almost anything will benefit
noticeably by optimized divisions-by-10/remainders in stdio.
Just think how much of data is converted back and forth by top
(and kernel) on each refresh...
--
vda



More information about the busybox mailing list