Deleted Added
sdiff udiff text old ( 178063 ) new ( 181881 )
full compact
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 $");
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
87 { "_cnt" },
88#define X_BOOTTIME 2
89 { "_boottime" },
90#define X_HZ 3
91 { "_hz" },
92#define X_STATHZ 4
93 { "_stathz" },
94#define X_NCHSTATS 5
95 { "_nchstats" },
96#define X_INTRNAMES 6
97 { "_intrnames" },
98#define X_EINTRNAMES 7
99 { "_eintrnames" },
100#define X_INTRCNT 8
101 { "_intrcnt" },
102#define X_EINTRCNT 9
103 { "_eintrcnt" },
104#define X_KMEMSTATS 10
105 { "_kmemstatistics" },
106#define X_KMEMZONES 11
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
119#define X_END 12
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) {
613 kread(X_CPTIME, cur.cp_time, sizeof(cur.cp_time));
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 ---