summaryrefslogtreecommitdiff
path: root/usr.bin/vmstat
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-07-02 09:12:38 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-07-02 09:12:38 +0000
commit2f4b2ec33f3ea470a851099e7b35326b198fe6e9 (patch)
tree5e3752dd3603ce785d61ca4863082caa97399f7d /usr.bin/vmstat
parent8a2dae89c382f0e69918da2efdc03f37d8c6c6a8 (diff)
Do not divide by zero in vmstat -t; Nikos Ntarmos.
Diffstat (limited to 'usr.bin/vmstat')
-rw-r--r--usr.bin/vmstat/vmstat.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index 369634ddea9..f9d4e21e572 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -1,5 +1,5 @@
/* $NetBSD: vmstat.c,v 1.29.4.1 1996/06/05 00:21:05 cgd Exp $ */
-/* $OpenBSD: vmstat.c,v 1.88 2004/06/28 21:49:35 jmc Exp $ */
+/* $OpenBSD: vmstat.c,v 1.89 2004/07/02 09:12:37 miod Exp $ */
/*
* Copyright (c) 1980, 1986, 1991, 1993
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)vmstat.c 8.1 (Berkeley) 6/6/93";
#else
-static const char rcsid[] = "$OpenBSD: vmstat.c,v 1.88 2004/06/28 21:49:35 jmc Exp $";
+static const char rcsid[] = "$OpenBSD: vmstat.c,v 1.89 2004/07/02 09:12:37 miod Exp $";
#endif
#endif /* not lint */
@@ -503,12 +503,15 @@ dotimes(void)
(void)printf("%u reactivates, %u total time (usec)\n",
uvmexp.pdreact, rectime);
- (void)printf("average: %u usec / reclaim\n", rectime / uvmexp.pdreact);
+ if (uvmexp.pdreact != 0)
+ (void)printf("average: %u usec / reclaim\n",
+ rectime / uvmexp.pdreact);
(void)printf("\n");
(void)printf("%u page ins, %u total time (msec)\n",
uvmexp.pageins, pgintime / 10);
- (void)printf("average: %8.1f msec / page in\n",
- pgintime / (uvmexp.pageins * 10.0));
+ if (uvmexp.pageins != 0)
+ (void)printf("average: %8.1f msec / page in\n",
+ pgintime / (uvmexp.pageins * 10.0));
}
int