1/* 2 * Copyright (c) 1980, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39 40#if 0 41#ifndef lint 42static char sccsid[] = "@(#)vmstat.c 8.1 (Berkeley) 6/6/93"; 43#endif /* not lint */ 44#endif 45 46#include <sys/cdefs.h> |
47__FBSDID("$FreeBSD: head/usr.bin/vmstat/vmstat.c 181881 2008-08-19 21:33:09Z jhb $"); |
48 49#include <sys/param.h> 50#include <sys/time.h> 51#include <sys/proc.h> 52#include <sys/uio.h> 53#include <sys/namei.h> 54#include <sys/malloc.h> 55#include <sys/signal.h> --- 20 unchanged lines hidden (view full) --- 76#include <sysexits.h> 77#include <time.h> 78#include <unistd.h> 79#include <libutil.h> 80 81static char da[] = "da"; 82 83static struct nlist namelist[] = { |
84#define X_SUM 0 |
85 { "_cnt" }, |
86#define X_BOOTTIME 1 |
87 { "_boottime" }, |
88#define X_HZ 2 |
89 { "_hz" }, |
90#define X_STATHZ 3 |
91 { "_stathz" }, |
92#define X_NCHSTATS 4 |
93 { "_nchstats" }, |
94#define X_INTRNAMES 5 |
95 { "_intrnames" }, |
96#define X_EINTRNAMES 6 |
97 { "_eintrnames" }, |
98#define X_INTRCNT 7 |
99 { "_intrcnt" }, |
100#define X_EINTRCNT 8 |
101 { "_eintrcnt" }, |
102#define X_KMEMSTATS 9 |
103 { "_kmemstatistics" }, |
104#define X_KMEMZONES 10 |
105 { "_kmemzones" }, 106#ifdef notyet 107#define X_DEFICIT XXX 108 { "_deficit" }, 109#define X_REC XXX 110 { "_rectime" }, 111#define X_PGIN XXX 112 { "_pgintime" }, 113#define X_XSTATS XXX 114 { "_xstats" }, 115#define X_END XXX 116#else |
117#define X_END 11 |
118#endif 119 { "" }, 120}; 121 122static struct statinfo cur, last; 123static int num_devices, maxshowdevs; 124static long generation; 125static struct device_selection *dev_select; --- 477 unchanged lines hidden (view full) --- 603 last_cp_times = malloc(size_cp_times); 604 bzero(cur_cp_times, size_cp_times); 605 bzero(last_cp_times, size_cp_times); 606 } 607 for (hdrcnt = 1;;) { 608 if (!--hdrcnt) 609 printhdr(ncpus, cpumask); 610 if (kd != NULL) { |
611 if (kvm_getcptime(kd, cur.cp_time) < 0) 612 errx(1, "kvm_getcptime: %s", kvm_geterr(kd)); |
613 } else { 614 size = sizeof(cur.cp_time); 615 mysysctl("kern.cp_time", &cur.cp_time, &size, NULL, 0); 616 if (size != sizeof(cur.cp_time)) 617 errx(1, "cp_time size mismatch"); 618 } 619 if (Pflag) { 620 size = size_cp_times; --- 602 unchanged lines hidden --- |