Fix "slow (on-the-fly) zero fills percentage (`%slo-z')" some more. The

value printed is actually the optimized (i.e., the non-slow, not-on-the-fly
zero fills percentage) except in overflow cases.  Describe it as %ozfod
in the display.  Move the field descriptor 1 to the left so that there
is space for 5 characters after the % sign (this leaves no space between
the number and the descriptor but the % character serves well as a
separator).

Fixed integer overflow at z.ozfod = UINT_MAX/100 in the calculation of
%ozfod.  This value can be reached just a few hours or minutes after
booting, so %ozfod was usually garbage in boot mode.  Now %ozfod is
correct in boot mode for a few days or hours.

Print a non-dummy %ozfod when the division for it isn't division by 0
instead of when the result will be less than 100%.  A result of 100%
may be correct, though a result of more than 100% indicates overflow
of one or both counters.
This commit is contained in:
Bruce Evans 2006-04-30 07:27:23 +00:00
parent a7a6dfbd14
commit 6e977072c6
2 changed files with 4 additions and 4 deletions

View File

@ -367,7 +367,7 @@ memory system which list the average number of
pages copied on write (`cow'),
pages zero filled on demand (`zfod'),
pages optimize zero filled on demand (`ozfod'),
slow (on-the-fly) zero fills percentage (`%sloz'),
the ratio ozfod / zfod as a percentage (`%ozfod'),
total pages freed (`totfr'),
pages wired down (`wire'),
active pages (`act'),

View File

@ -392,7 +392,7 @@ labelkre()
*/
mvprintw(VMSTATROW + 11, VMSTATCOL - 6, "zfod");
mvprintw(VMSTATROW + 12, VMSTATCOL - 6, "ozfod");
mvprintw(VMSTATROW + 13, VMSTATCOL - 6, "%%sloz");
mvprintw(VMSTATROW + 13, VMSTATCOL - 7, "%%ozfod");
mvprintw(VMSTATROW + 14, VMSTATCOL - 6, "totfr");
extended_vm_stats = 1;
} else {
@ -530,8 +530,8 @@ showkre()
PUTRATE(v_zfod, VMSTATROW + 11, VMSTATCOL - 16, 9);
PUTRATE(v_ozfod, VMSTATROW + 12, VMSTATCOL - 16, 9);
putint(
((s.v_ozfod < s.v_zfod) ?
s.v_ozfod * 100 / s.v_zfod :
((s.v_zfod != 0) ?
(int)(s.v_ozfod * 100.0 / s.v_zfod) :
0
),
VMSTATROW + 13,