vmstat.c (178063) | vmstat.c (181881) |
---|---|
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> | 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 178063 2008-04-10 09:56:57Z ru $"); | 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[] = { | 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_CPTIME 0 85 { "_cp_time" }, 86#define X_SUM 1 | 84#define X_SUM 0 |
87 { "_cnt" }, | 85 { "_cnt" }, |
88#define X_BOOTTIME 2 | 86#define X_BOOTTIME 1 |
89 { "_boottime" }, | 87 { "_boottime" }, |
90#define X_HZ 3 | 88#define X_HZ 2 |
91 { "_hz" }, | 89 { "_hz" }, |
92#define X_STATHZ 4 | 90#define X_STATHZ 3 |
93 { "_stathz" }, | 91 { "_stathz" }, |
94#define X_NCHSTATS 5 | 92#define X_NCHSTATS 4 |
95 { "_nchstats" }, | 93 { "_nchstats" }, |
96#define X_INTRNAMES 6 | 94#define X_INTRNAMES 5 |
97 { "_intrnames" }, | 95 { "_intrnames" }, |
98#define X_EINTRNAMES 7 | 96#define X_EINTRNAMES 6 |
99 { "_eintrnames" }, | 97 { "_eintrnames" }, |
100#define X_INTRCNT 8 | 98#define X_INTRCNT 7 |
101 { "_intrcnt" }, | 99 { "_intrcnt" }, |
102#define X_EINTRCNT 9 | 100#define X_EINTRCNT 8 |
103 { "_eintrcnt" }, | 101 { "_eintrcnt" }, |
104#define X_KMEMSTATS 10 | 102#define X_KMEMSTATS 9 |
105 { "_kmemstatistics" }, | 103 { "_kmemstatistics" }, |
106#define X_KMEMZONES 11 | 104#define X_KMEMZONES 10 |
107 { "_kmemzones" }, 108#ifdef notyet 109#define X_DEFICIT XXX 110 { "_deficit" }, 111#define X_REC XXX 112 { "_rectime" }, 113#define X_PGIN XXX 114 { "_pgintime" }, 115#define X_XSTATS XXX 116 { "_xstats" }, 117#define X_END XXX 118#else | 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 |
119#define X_END 12 | 117#define X_END 11 |
120#endif 121 { "" }, 122}; 123 124static struct statinfo cur, last; 125static int num_devices, maxshowdevs; 126static long generation; 127static struct device_selection *dev_select; --- 477 unchanged lines hidden (view full) --- 605 last_cp_times = malloc(size_cp_times); 606 bzero(cur_cp_times, size_cp_times); 607 bzero(last_cp_times, size_cp_times); 608 } 609 for (hdrcnt = 1;;) { 610 if (!--hdrcnt) 611 printhdr(ncpus, cpumask); 612 if (kd != NULL) { | 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) { |
613 kread(X_CPTIME, cur.cp_time, sizeof(cur.cp_time)); | 611 if (kvm_getcptime(kd, cur.cp_time) < 0) 612 errx(1, "kvm_getcptime: %s", kvm_geterr(kd)); |
614 } else { 615 size = sizeof(cur.cp_time); 616 mysysctl("kern.cp_time", &cur.cp_time, &size, NULL, 0); 617 if (size != sizeof(cur.cp_time)) 618 errx(1, "cp_time size mismatch"); 619 } 620 if (Pflag) { 621 size = size_cp_times; --- 602 unchanged lines hidden --- | 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 --- |