summaryrefslogtreecommitdiff
path: root/usr.bin/systat
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-06-25 20:47:01 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-06-25 20:47:01 +0000
commit98a727c3af81ac9dde91d9967d226f36f375414e (patch)
tree07c5505bbe64f579f636af7a1b50d2eb9dbdb57e /usr.bin/systat
parent061e58ab0cf6bd729c78ce52ee084500723dfad9 (diff)
Show interrupt counts on i386.
Diffstat (limited to 'usr.bin/systat')
-rw-r--r--usr.bin/systat/vmstat.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 4db84af9ccb..d31596affb4 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -65,6 +65,12 @@ static char rcsid[] = "$NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $
#include <utmp.h>
#include <unistd.h>
+#if defined(i386)
+#define _KERNEL
+#include <machine/psl.h>
+#undef _KERNEL
+#endif
+
#include "systat.h"
#include "extern.h"
@@ -161,6 +167,10 @@ static struct nlist namelist[] = {
{ "_intrcnt" },
#define X_EINTRCNT 12
{ "_eintrcnt" },
+#if defined(i386)
+#define X_INTRHAND 13
+ { "_intrhand" },
+#endif
{ "" },
};
@@ -226,6 +236,36 @@ initkre()
#undef allocate
}
if (nintr == 0) {
+#if defined(i386)
+ struct intrhand *intrhand[16], *ihp, ih;
+ char iname[16];
+ int namelen, n;
+
+ NREAD(X_INTRHAND, intrhand, sizeof(intrhand));
+ for (namelen = 0, i = 0; i < 16; i++) {
+ ihp = intrhand[i];
+ while (ihp) {
+ nintr++;
+ KREAD(ihp, &ih, sizeof(ih));
+ KREAD(ih.ih_what, iname, 16);
+ namelen += 1 + strlen(iname);
+ ihp = ih.ih_next;
+ }
+ }
+ intrloc = calloc(nintr, sizeof (long));
+ intrname = calloc(nintr, sizeof (char *));
+ cp = intrnamebuf = malloc(namelen);
+ for (namelen = 0, i = 0, n = 0; i < 16; i++) {
+ ihp = intrhand[i];
+ while (ihp) {
+ KREAD(ihp, &ih, sizeof(ih));
+ KREAD(ih.ih_what, iname, 16);
+ strcpy(intrname[n++] = intrnamebuf + namelen, iname);
+ namelen += 1 + strlen(iname);
+ ihp = ih.ih_next;
+ }
+ }
+#else
nintr = (namelist[X_EINTRCNT].n_value -
namelist[X_INTRCNT].n_value) / sizeof (long);
intrloc = calloc(nintr, sizeof (long));
@@ -249,6 +289,7 @@ initkre()
intrname[i] = cp;
cp += strlen(cp) + 1;
}
+#endif
nextintsrow = INTSROW + 2;
allocinfo(&s);
allocinfo(&s1);
@@ -611,12 +652,28 @@ getinfo(s, st)
int mib[2];
size_t size;
extern int errno;
+#if defined(i386)
+ struct intrhand *intrhand[16], *ihp, ih;
+ int i, n;
+#endif
dkreadstats();
NREAD(X_CPTIME, s->time, sizeof s->time);
NREAD(X_CNT, &s->Cnt, sizeof s->Cnt);
NREAD(X_NCHSTATS, &s->nchstats, sizeof s->nchstats);
+#if defined(i386)
+ NREAD(X_INTRHAND, intrhand, sizeof(intrhand));
+ for (i = 0, n = 0; i < 16; i++) {
+ ihp = intrhand[i];
+ while (ihp) {
+ KREAD(ihp, &ih, sizeof(ih));
+ s->intrcnt[n++] = ih.ih_count;
+ ihp = ih.ih_next;
+ }
+ }
+#else
NREAD(X_INTRCNT, s->intrcnt, nintr * LONG);
+#endif
size = sizeof(s->Total);
mib[0] = CTL_VM;
mib[1] = VM_METER;