2 * Copyright (c) 1980, 1986, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#) Copyright (c) 1980, 1986, 1991, 1993 The Regents of the University of California. All rights reserved.
34 * @(#)vmstat.c 8.1 (Berkeley) 6/6/93
35 * $FreeBSD: src/usr.bin/vmstat/vmstat.c,v 1.38.2.4 2001/07/31 19:52:41 tmm Exp $
36 * $DragonFly: src/usr.bin/vmstat/vmstat.c,v 1.23 2008/02/19 18:19:15 thomas Exp $
40 #include <sys/param.h>
43 #include <sys/namei.h>
44 #include <sys/malloc.h>
45 #include <sys/signal.h>
46 #include <sys/fcntl.h>
47 #include <sys/ioctl.h>
48 #include <sys/sysctl.h>
49 #include <sys/vmmeter.h>
51 #include <vm/vm_param.h>
69 static struct nlist namelist[] = {
71 { "_boottime", 0, 0, 0, 0 },
73 { "_nchstats", 0, 0, 0, 0 },
74 #define X_KMEMSTATISTICS 2
75 { "_kmemstatistics", 0, 0, 0, 0 },
77 { "_zlist", 0, 0, 0, 0 },
80 { "_deficit", 0, 0, 0, 0 },
82 { "_forkstat", 0, 0, 0, 0 },
84 { "_rectime", 0, 0, 0, 0 },
86 { "_pgintime", 0, 0, 0, 0 },
88 { "_xstats", 0, 0, 0, 0 },
96 struct statinfo cur, last;
97 int num_devices, maxshowdevs;
99 struct device_selection *dev_select;
101 struct devstat_match *matches;
103 int num_devices_specified, num_selections;
104 long select_generation;
105 char **specified_devices;
106 devstat_select_mode select_mode;
108 struct vmmeter vmm, ovmm;
109 struct vmstats vms, ovms;
117 struct kinfo_cputime cp_time, old_cp_time, diff_cp_time;
119 #define FORKSTAT 0x01
120 #define INTRSTAT 0x02
123 #define TIMESTAT 0x10
125 #define ZMEMSTAT 0x40
127 static void cpustats(void);
128 static void dointr(void);
129 static void domem(void);
130 static void dosum(void);
131 static void dozmem(void);
132 static void dovmstat(u_int, int);
133 static void kread(int, void *, size_t);
134 static void usage(void);
135 static char **getdrivedata(char **);
136 static long getuptime(void);
137 static void needhdr(int);
138 static long pct(long, long);
141 static void dotimes(void); /* Not implemented */
142 static void doforkst(void);
144 static void printhdr(void);
145 static void devstats(void);
148 main(int argc, char **argv)
151 u_int interval; /* milliseconds */
154 char errbuf[_POSIX2_LINE_MAX];
156 memf = nlistf = NULL;
157 interval = reps = todo = 0;
159 while ((c = getopt(argc, argv, "c:fiM:mN:n:p:stvw:z")) != -1) {
168 errx(EX_USAGE, "sorry, -f is not (re)implemented yet");
185 maxshowdevs = atoi(optarg);
187 errx(1, "number of devices %d is < 0",
191 if (buildmatch(optarg, &matches, &num_matches) != 0)
192 errx(1, "%s", devstat_errbuf);
201 errx(EX_USAGE, "sorry, -t is not (re)implemented yet");
208 interval = (u_int)(strtod(optarg, NULL) * 1000.0);
224 * Discard setgid privileges if not the running kernel so that bad
225 * guys can't print interesting stuff from kernel memory.
227 if (nlistf != NULL || memf != NULL)
230 kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
232 errx(1, "kvm_openfiles: %s", errbuf);
234 if ((c = kvm_nlist(kd, namelist)) != 0) {
236 warnx("undefined symbols:");
237 for (c = 0; c < (int)__arysize(namelist); c++)
238 if (namelist[c].n_type == 0)
239 fprintf(stderr, " %s",
243 warnx("kvm_nlist: %s", kvm_geterr(kd));
248 struct winsize winsize;
251 * Make sure that the userland devstat version matches the
252 * kernel devstat version. If not, exit and print a
253 * message informing the user of his mistake.
255 if (checkversion() < 0)
256 errx(1, "%s", devstat_errbuf);
259 argv = getdrivedata(argv);
261 ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&winsize);
262 if (winsize.ws_row > 0)
263 winlines = winsize.ws_row;
267 #define BACKWARD_COMPATIBILITY
268 #ifdef BACKWARD_COMPATIBILITY
270 interval = (u_int)(strtod(*argv, NULL) * 1000.0);
300 dovmstat(interval, reps);
305 getdrivedata(char **argv)
307 if ((num_devices = getnumdevs()) < 0)
308 errx(1, "%s", devstat_errbuf);
310 cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
311 last.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
312 bzero(cur.dinfo, sizeof(struct devinfo));
313 bzero(last.dinfo, sizeof(struct devinfo));
315 if (getdevs(&cur) == -1)
316 errx(1, "%s", devstat_errbuf);
318 num_devices = cur.dinfo->numdevs;
319 generation = cur.dinfo->generation;
321 specified_devices = (char **)malloc(sizeof(char *));
322 for (num_devices_specified = 0; *argv; ++argv) {
325 num_devices_specified++;
326 specified_devices = (char **)realloc(specified_devices,
328 num_devices_specified);
329 specified_devices[num_devices_specified - 1] = *argv;
333 if (nflag == 0 && maxshowdevs < num_devices_specified)
334 maxshowdevs = num_devices_specified;
337 * People are generally only interested in disk statistics when
338 * they're running vmstat. So, that's what we're going to give
339 * them if they don't specify anything by default. We'll also give
340 * them any other random devices in the system so that we get to
341 * maxshowdevs devices, if that many devices exist. If the user
342 * specifies devices on the command line, either through a pattern
343 * match or by naming them explicitly, we will give the user only
346 if ((num_devices_specified == 0) && (num_matches == 0)) {
347 if (buildmatch("da", &matches, &num_matches) != 0)
348 errx(1, "%s", devstat_errbuf);
350 select_mode = DS_SELECT_ADD;
352 select_mode = DS_SELECT_ONLY;
355 * At this point, selectdevs will almost surely indicate that the
356 * device list has changed, so we don't look for return values of 0
357 * or 1. If we get back -1, though, there is an error.
359 if (selectdevs(&dev_select, &num_selected, &num_selections,
360 &select_generation, generation, cur.dinfo->devices,
361 num_devices, matches, num_matches, specified_devices,
362 num_devices_specified, select_mode,
363 maxshowdevs, 0) == -1)
364 errx(1, "%s", devstat_errbuf);
372 static time_t now, boottime;
376 kread(X_BOOTTIME, &boottime, sizeof(boottime));
378 uptime = now - boottime;
379 if (uptime <= 0 || uptime > 60*60*24*365*10)
380 errx(1, "time makes no sense; namelist must be wrong");
387 dovmstat(u_int interval, int reps)
389 struct vmtotal total;
390 struct devinfo *tmp_dinfo;
391 size_t vmm_size = sizeof(vmm);
392 size_t vms_size = sizeof(vms);
393 size_t vmt_size = sizeof(total);
396 signal(SIGCONT, needhdr);
401 if (kinfo_get_sched_cputime(&cp_time))
402 err(1, "kinfo_get_sched_cputime");
404 tmp_dinfo = last.dinfo;
405 last.dinfo = cur.dinfo;
406 cur.dinfo = tmp_dinfo;
407 last.busy_time = cur.busy_time;
410 * Here what we want to do is refresh our device stats.
411 * getdevs() returns 1 when the device list has changed.
412 * If the device list has changed, we want to go through
413 * the selection process again, in case a device that we
414 * were previously displaying has gone away.
416 switch (getdevs(&cur)) {
418 errx(1, "%s", devstat_errbuf);
423 num_devices = cur.dinfo->numdevs;
424 generation = cur.dinfo->generation;
426 retval = selectdevs(&dev_select, &num_selected,
427 &num_selections, &select_generation,
428 generation, cur.dinfo->devices,
429 num_devices, matches, num_matches,
431 num_devices_specified, select_mode,
435 errx(1, "%s", devstat_errbuf);
448 if (sysctlbyname("vm.vmstats", &vms, &vms_size, NULL, 0)) {
449 perror("sysctlbyname: vm.vmstats");
452 if (sysctlbyname("vm.vmmeter", &vmm, &vmm_size, NULL, 0)) {
453 perror("sysctlbyname: vm.vmmeter");
456 if (sysctlbyname("vm.vmtotal", &total, &vmt_size, NULL, 0)) {
457 perror("sysctlbyname: vm.vmtotal");
460 printf("%2ld %1ld %1ld",
461 total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw);
463 #define vmstat_pgtok(a) \
464 (intmax_t)(((intmax_t)(a) * vms.v_page_size) >> 10)
466 (intmax_t)(initial ? (x) : ((intmax_t)(x) * 1000 + interval / 2) \
469 printf(" %7jd %6jd ",
470 vmstat_pgtok(total.t_avm),
471 vmstat_pgtok(total.t_free));
473 rate(vmm.v_vm_faults - ovmm.v_vm_faults));
475 rate(vmm.v_reactivated - ovmm.v_reactivated));
477 rate(vmm.v_swapin + vmm.v_vnodein -
478 (ovmm.v_swapin + ovmm.v_vnodein)));
480 rate(vmm.v_swapout + vmm.v_vnodeout -
481 (ovmm.v_swapout + ovmm.v_vnodeout)));
483 rate(vmm.v_tfree - ovmm.v_tfree));
485 rate(vmm.v_pdpages - ovmm.v_pdpages));
487 printf("%4ju %4ju %3ju ",
488 rate(vmm.v_intr - ovmm.v_intr),
489 rate(vmm.v_syscall - ovmm.v_syscall),
490 rate(vmm.v_swtch - ovmm.v_swtch));
494 if (reps >= 0 && --reps <= 0)
497 usleep(interval * 1000);
507 num_shown = (num_selected < maxshowdevs) ? num_selected : maxshowdevs;
508 printf(" procs memory page%*s", 19, "");
510 printf(" disks %*s", num_shown * 4 - 7, "");
511 else if (num_shown == 1)
513 printf(" faults cpu\n");
514 printf(" r b w avm fre flt re pi po fr sr ");
515 for (i = 0; i < num_devices; i++)
516 if ((dev_select[i].selected)
517 && (dev_select[i].selected <= maxshowdevs))
518 printf("%c%c%d ", dev_select[i].device_name[0],
519 dev_select[i].device_name[1],
520 dev_select[i].unit_number);
521 printf(" in sy cs us sy id\n");
522 hdrcnt = winlines - 2;
526 * Force a header to be prepended to the next output.
529 needhdr(__unused int signo)
536 pct(long top, long bot)
542 ans = (quad_t)top * 100 / bot;
546 #define PCT(top, bot) pct((long)(top), (long)(bot))
551 struct nchstats *nch_tmp, nchstats;
552 size_t vms_size = sizeof(vms);
553 size_t vmm_size = sizeof(vmm);
557 size_t nch_size = sizeof(struct nchstats) * SMP_MAXCPU;
559 if (sysctlbyname("vm.vmstats", &vms, &vms_size, NULL, 0)) {
560 perror("sysctlbyname: vm.vmstats");
563 if (sysctlbyname("vm.vmmeter", &vmm, &vmm_size, NULL, 0)) {
564 perror("sysctlbyname: vm.vmstats");
567 printf("%9u cpu context switches\n", vmm.v_swtch);
568 printf("%9u device interrupts\n", vmm.v_intr);
569 printf("%9u software interrupts\n", vmm.v_soft);
570 printf("%9u traps\n", vmm.v_trap);
571 printf("%9u system calls\n", vmm.v_syscall);
572 printf("%9u kernel threads created\n", vmm.v_kthreads);
573 printf("%9u fork() calls\n", vmm.v_forks);
574 printf("%9u vfork() calls\n", vmm.v_vforks);
575 printf("%9u rfork() calls\n", vmm.v_rforks);
576 printf("%9u exec() calls\n", vmm.v_exec);
577 printf("%9u swap pager pageins\n", vmm.v_swapin);
578 printf("%9u swap pager pages paged in\n", vmm.v_swappgsin);
579 printf("%9u swap pager pageouts\n", vmm.v_swapout);
580 printf("%9u swap pager pages paged out\n", vmm.v_swappgsout);
581 printf("%9u vnode pager pageins\n", vmm.v_vnodein);
582 printf("%9u vnode pager pages paged in\n", vmm.v_vnodepgsin);
583 printf("%9u vnode pager pageouts\n", vmm.v_vnodeout);
584 printf("%9u vnode pager pages paged out\n", vmm.v_vnodepgsout);
585 printf("%9u page daemon wakeups\n", vmm.v_pdwakeups);
586 printf("%9u pages examined by the page daemon\n", vmm.v_pdpages);
587 printf("%9u pages reactivated\n", vmm.v_reactivated);
588 printf("%9u copy-on-write faults\n", vmm.v_cow_faults);
589 printf("%9u copy-on-write optimized faults\n", vmm.v_cow_optim);
590 printf("%9u zero fill pages zeroed\n", vmm.v_zfod);
591 printf("%9u zero fill pages prezeroed\n", vmm.v_ozfod);
592 printf("%9u intransit blocking page faults\n", vmm.v_intrans);
593 printf("%9u total VM faults taken\n", vmm.v_vm_faults);
594 printf("%9u pages affected by kernel thread creation\n", vmm.v_kthreadpages);
595 printf("%9u pages affected by fork()\n", vmm.v_forkpages);
596 printf("%9u pages affected by vfork()\n", vmm.v_vforkpages);
597 printf("%9u pages affected by rfork()\n", vmm.v_rforkpages);
598 printf("%9u pages freed\n", vmm.v_tfree);
599 printf("%9u pages freed by daemon\n", vmm.v_dfree);
600 printf("%9u pages freed by exiting processes\n", vmm.v_pfree);
601 printf("%9u pages active\n", vms.v_active_count);
602 printf("%9u pages inactive\n", vms.v_inactive_count);
603 printf("%9u pages in VM cache\n", vms.v_cache_count);
604 printf("%9u pages wired down\n", vms.v_wire_count);
605 printf("%9u pages free\n", vms.v_free_count);
606 printf("%9u bytes per page\n", vms.v_page_size);
607 printf("%9u global smp invltlbs\n", vmm.v_smpinvltlb);
609 if ((nch_tmp = malloc(nch_size)) == NULL) {
613 if (sysctlbyname("vfs.cache.nchstats", nch_tmp, &nch_size, NULL, 0)) {
614 perror("sysctlbyname vfs.cache.nchstats");
618 if ((nch_tmp = realloc(nch_tmp, nch_size)) == NULL) {
625 cpucnt = nch_size / sizeof(struct nchstats);
626 kvm_nch_cpuagg(nch_tmp, &nchstats, cpucnt);
628 nchtotal = nchstats.ncs_goodhits + nchstats.ncs_neghits +
629 nchstats.ncs_badhits + nchstats.ncs_falsehits +
631 nchpathtotal = nchstats.ncs_longhits + nchstats.ncs_longmiss;
632 printf("%9ld total path lookups\n", nchpathtotal);
633 printf("%9ld total component lookups\n", nchtotal);
635 "%9s cache hits (%ld%% pos + %ld%% neg)\n",
636 "", PCT(nchstats.ncs_goodhits, nchtotal),
637 PCT(nchstats.ncs_neghits, nchtotal));
638 printf("%9s deletions %ld%%, falsehits %ld%%\n", "",
639 PCT(nchstats.ncs_badhits, nchtotal),
640 PCT(nchstats.ncs_falsehits, nchtotal));
650 kread(X_FORKSTAT, &fks, sizeof(struct forkstat));
651 printf("%d forks, %d pages, average %.2f\n",
652 fks.cntfork, fks.sizfork, (double)fks.sizfork / fks.cntfork);
653 printf("%d vforks, %d pages, average %.2f\n",
654 fks.cntvfork, fks.sizvfork, (double)fks.sizvfork / fks.cntvfork);
662 long double transfers_per_second;
663 long double busy_seconds;
665 diff_cp_time.cp_user = cp_time.cp_user - old_cp_time.cp_user;
666 diff_cp_time.cp_nice = cp_time.cp_nice - old_cp_time.cp_nice;
667 diff_cp_time.cp_sys = cp_time.cp_sys - old_cp_time.cp_sys;
668 diff_cp_time.cp_intr = cp_time.cp_intr - old_cp_time.cp_intr;
669 diff_cp_time.cp_idle = cp_time.cp_idle - old_cp_time.cp_idle;
670 old_cp_time = cp_time;
672 busy_seconds = compute_etime(cur.busy_time, last.busy_time);
674 for (dn = 0; dn < num_devices; dn++) {
677 if ((dev_select[dn].selected == 0)
678 || (dev_select[dn].selected > maxshowdevs))
681 di = dev_select[dn].position;
683 if (compute_stats(&cur.dinfo->devices[di],
684 &last.dinfo->devices[di], busy_seconds,
686 NULL, &transfers_per_second, NULL,
688 errx(1, "%s", devstat_errbuf);
690 printf("%3.0Lf ", transfers_per_second);
700 total = diff_cp_time.cp_user + diff_cp_time.cp_nice +
701 diff_cp_time.cp_sys + diff_cp_time.cp_intr + diff_cp_time.cp_idle;
704 totusage = 100.0 / total;
708 (diff_cp_time.cp_user + diff_cp_time.cp_nice) * totusage);
710 (diff_cp_time.cp_sys + diff_cp_time.cp_intr) * totusage);
712 diff_cp_time.cp_idle * totusage);
718 u_long *intrcnt, uptime;
720 size_t nintr, inamlen, i, size;
725 uptime = getuptime();
726 if (sysctlbyname("hw.intrnames", NULL, &inamlen, NULL, 0) != 0)
727 errx(1, "sysctlbyname");
728 intrstr = malloc(inamlen);
731 sysctlbyname("hw.intrnames", intrstr, &inamlen, NULL, 0);
732 for (nintr = 0, i = 0; i < inamlen; ++i) {
736 intrname = malloc(nintr * sizeof(char *));
737 for (i = 0; i < nintr; ++i) {
738 intrname[i] = intrstr;
739 intrstr += strlen(intrstr) + 1;
742 size = nintr * sizeof(*intrcnt);
743 intrcnt = calloc(nintr, sizeof(*intrcnt));
746 sysctlbyname("hw.intrcnt_all", intrcnt, &size, NULL, 0);
749 for (i = 0; i < nintr; ++i) {
750 if (nwidth < (int)strlen(intrname[i]))
751 nwidth = (int)strlen(intrname[i]);
753 if (verbose) nwidth += 8;
755 printf("%-*.*s %11s %10s\n",
756 nwidth, nwidth, "interrupt", "total", "rate");
758 for (i = 0; i < nintr; ++i) {
760 char *infop, irqinfo[72];
762 if ((named = strncmp(intrname[i], "irq", 3)) != 0 ||
765 if (verbose && named) {
766 snprintf(irqinfo, sizeof(irqinfo),
767 "irq%zd: %s", i, intrname[i]);
770 printf("%-*.*s %11lu %10lu\n",
771 nwidth, nwidth, infop,
772 intrcnt[i], intrcnt[i] / uptime);
774 inttotal += intrcnt[i];
776 printf("%-*.*s %11llu %10llu\n",
777 nwidth, nwidth, "Total",
778 (long long)inttotal, (long long)(inttotal / uptime));
781 #define MAX_KMSTATS 1024
789 for (i = ttl = 0; i < SMP_MAXCPU; ++i)
797 struct malloc_type *ks;
800 long totuse = 0, totfree = 0, totreq = 0;
801 struct malloc_type kmemstats[MAX_KMSTATS], *kmsp;
804 kread(X_KMEMSTATISTICS, &kmsp, sizeof(kmsp));
805 for (nkms = 0; nkms < MAX_KMSTATS && kmsp != NULL; nkms++) {
806 if (sizeof(kmemstats[0]) != kvm_read(kd, (u_long)kmsp,
807 &kmemstats[nkms], sizeof(kmemstats[0])))
808 err(1, "kvm_read(%p)", (void *)kmsp);
809 if (sizeof(buf) != kvm_read(kd,
810 (u_long)kmemstats[nkms].ks_shortdesc, buf, sizeof(buf)))
811 err(1, "kvm_read(%p)",
812 kmemstats[nkms].ks_shortdesc);
813 buf[sizeof(buf) - 1] = '\0';
814 kmemstats[nkms].ks_shortdesc = strdup(buf);
815 kmsp = kmemstats[nkms].ks_next;
818 warnx("truncated to the first %d memory types", nkms);
821 "\nMemory statistics by type Type Kern\n");
823 " Type InUse MemUse HighUse Limit Requests Limit Limit\n");
824 for (i = 0, ks = &kmemstats[0]; i < nkms; i++, ks++) {
825 if (ks->ks_calls == 0)
827 printf("%19s%7ld%7ldK%7ldK%11zdK%10jd%5u%6u",
829 cpuagg(ks->ks_inuse), (cpuagg(ks->ks_memuse) + 1023) / 1024,
830 (ks->ks_maxused + 1023) / 1024,
831 (ks->ks_limit + 1023) / 1024, (intmax_t)ks->ks_calls,
832 ks->ks_limblocks, ks->ks_mapblocks);
834 for (j = 1 << MINBUCKET; j < 1 << (MINBUCKET + 16); j <<= 1) {
835 if ((ks->ks_size & j) == 0)
848 totuse += cpuagg(ks->ks_memuse);
849 totreq += ks->ks_calls;
851 printf("\nMemory Totals: In Use Free Requests\n");
852 printf(" %7ldK %6ldK %8ld\n",
853 (totuse + 1023) / 1024, (totfree + 1023) / 1024, totreq);
865 if ((buf = realloc(buf, bufsize)) == NULL)
867 if (sysctlbyname("vm.zone", buf, &bufsize, NULL, 0) == 0)
873 buf[bufsize] = '\0'; /* play it safe */
874 printf("%s\n\n", buf);
879 * kread reads something from the kernel, given its nlist index.
882 kread(int nlx, void *addr, size_t size)
886 if (namelist[nlx].n_type == 0 || namelist[nlx].n_value == 0) {
887 sym = namelist[nlx].n_name;
890 errx(1, "symbol %s not defined", sym);
892 if (kvm_read(kd, namelist[nlx].n_value, addr, size) != (ssize_t)size) {
893 sym = namelist[nlx].n_name;
896 errx(1, "%s: %s", sym, kvm_geterr(kd));
903 fprintf(stderr, "%s%s",
904 "usage: vmstat [-imsvz] [-c count] [-M core] [-N system] [-w wait]\n",
905 " [-n devs] [disks]\n");