summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat/vmstat.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2006-04-30 07:27:23 +0000
committerbde <bde@FreeBSD.org>2006-04-30 07:27:23 +0000
commit601ee9993aa18a97c65a6b58b7be9501198c5fca (patch)
tree11f57bb9110980574e008b41476e32950f62b2bb /usr.bin/systat/vmstat.c
parente3a87fd595ba1ed181fbc8ecbbcf6145918ace68 (diff)
downloadFreeBSD-src-601ee9993aa18a97c65a6b58b7be9501198c5fca.zip
FreeBSD-src-601ee9993aa18a97c65a6b58b7be9501198c5fca.tar.gz
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.
Diffstat (limited to 'usr.bin/systat/vmstat.c')
-rw-r--r--usr.bin/systat/vmstat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index a836fce..2ca4e8a 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -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,
OpenPOWER on IntegriCloud