diff options
author | 2004-06-11 16:09:08 +0000 | |
---|---|---|
committer | 2004-06-11 16:09:08 +0000 | |
commit | bf13fba891da6ed7116e0f8e3b83ba9690ab7c4a (patch) | |
tree | a46d07f5610d4b9c098ccf14e0c537902ecbcbf5 | |
parent | handle the KI_NOCPU case, pointed out by markus (diff) | |
download | wireguard-openbsd-bf13fba891da6ed7116e0f8e3b83ba9690ab7c4a.tar.xz wireguard-openbsd-bf13fba891da6ed7116e0f8e3b83ba9690ab7c4a.zip |
div etime by ncpu
-rw-r--r-- | usr.bin/vmstat/vmstat.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index d17941f0257..9ddc65b27fe 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.83 2004/06/11 05:54:55 deraadt Exp $ */ +/* $OpenBSD: vmstat.c,v 1.84 2004/06/11 16:09:08 deraadt 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.83 2004/06/11 05:54:55 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: vmstat.c,v 1.84 2004/06/11 16:09:08 deraadt Exp $"; #endif #endif /* not lint */ @@ -155,11 +155,15 @@ extern char *__progname; int verbose = 0; +int ncpu; + int main(int argc, char *argv[]) { extern int optind; extern char *optarg; + int mib[2]; + size_t size; int c, todo; u_int interval; int reps; @@ -250,6 +254,11 @@ main(int argc, char *argv[]) setegid(getegid()); setgid(getgid()); + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + size = sizeof(ncpu); + (void) sysctl(mib, 2, &ncpu, &size, NULL, 0); + if (todo & VMSTAT) { struct winsize winsize; @@ -671,6 +680,7 @@ dkstats(void) if (etime == 0) etime = 1; etime /= hz; + etime /= ncpu; for (dn = 0; dn < dk_ndrive; ++dn) { if (!dk_select[dn]) continue; |