bug in calcru()
Doug Ambrisko
ambrisko at ambrisko.com
Wed Jan 26 12:25:19 PST 2005
Chris Landauer writes:
| thanx for the suggestion - the notion of computing ut just with subtraction is
| really good, since it is likely to be the largest of the three values in most
| applications, but i'm a little worried that the 1024 multiplications aren't
| large enough when tt gets really large - i'll do the math on it and report its
| (provable) range of applicability and accuracy in a few days
I understand it wouldn't be exact but it will be better then the 100%
typical use ie. (10% system, 20% interrupt and 70% user). With the
stuff to ensure it is monitonically increasing you can get "wacky"
results so IMHO it will never be right but "good enough" Atleast that
is what I recall when I tested this stuff out a long time ago.
The assumption with this calculation is that st & it tend to be
small compared to tt so the 1024 X shouldn't overflow much.
| > Doug Ambrisko <ambrisko at ambrisko.com> wrote
| > ...
| > /* Subdivide tu. try to becareful of overflow */
| > su = tu * (st * 1024 / tt) / 1024;
| > iu = tu * (it * 1024 / tt) / 1024;
| > uu = tu - (su + iu);
| > ...
Doug A.
More information about the freebsd-hackers
mailing list