add interrupt meter support. mark as BROKEN for /alpha

This commit is contained in:
form 1998-11-24 02:54:28 +00:00
parent 78ac999f19
commit a1198e326d
3 changed files with 173 additions and 1 deletions

View File

@ -3,7 +3,7 @@
# Date created: 7 May 1998
# Whom: form
#
# $OpenBSD: Makefile,v 1.3 1998/11/20 06:23:38 form Exp $
# $OpenBSD: Makefile,v 1.4 1998/11/24 02:54:28 form Exp $
# NetBSD: Makefile,v 1.9 1998/04/15 10:38:50 agc Exp
#
@ -20,4 +20,8 @@ MAN1= xosview.1
MAKE_ENV+= UVM=${UVM}
MAKE_FLAGS= ARCH=${ARCH} -f
.if (${MACHINE_ARCH} == "alpha")
BROKEN= "compilation errors"
.endif
.include <bsd.port.mk>

View File

@ -0,0 +1,138 @@
*** bsd/kernel.cc.orig Fri Sep 25 02:21:30 1998
--- bsd/kernel.cc Mon Nov 23 10:12:36 1998
***************
*** 32,37 ****
--- 32,41 ----
#include <sys/disk.h> /* For disk statistics. */
#endif
+ #ifdef XOSVIEW_OPENBSD
+ #include "obsdintr.h" /* XXX: got from 2.4 */
+ #endif
+
#include <sys/socket.h> /* These two are needed for the */
#include <net/if.h> /* NetMeter helper functions. */
#if defined(XOSVIEW_FREEBSD) && (__FreeBSD_version >= 300000)
***************
*** 104,114 ****
--- 108,134 ----
#endif /* XOSVIEW_FREEBSD */
+ #if defined(XOSVIEW_OPENBSD) && (defined(pc532) || defined(i386))
+
+ # ifdef i386
+ { "_intrhand" },
+ #define INTRHAND_SYM_INDEX 7
+ { "_intrstray" },
+ #define INTRSTRAY_SYM_INDEX 8
+ # else
+ { "_ivt" },
+ #define IVT_SYM_INDEX 7
+ # endif
+
+ #else /* XOSVIEW_OPENBSD && (pc532 || i386) */
+
{ "_intrcnt" },
#define INTRCNT_SYM_INDEX 7
{ "_eintrcnt" },
#define EINTRCNT_SYM_INDEX 8
+ #endif /* XOSVIEW_OPENBSD && (pc532 || i386) */
+
{NULL}
};
***************
*** 441,447 ****
--- 461,470 ----
}
/* ---------------------- Interrupt Meter stuff ----------------- */
+ #if !defined(XOSVIEW_OPENBSD) || !(defined(pc532) && defined(i386))
static unsigned long kvm_intrcnt[128];// guess at space needed
+ #endif
+
#ifdef XOSVIEW_FREEBSD
static unsigned long kvm_intrptrs[NUM_INTR];
#endif
***************
*** 449,457 ****
--- 472,487 ----
int
BSDIntrInit() {
OpenKDIfNeeded();
+ #if defined(XOSVIEW_OPENBSD) && defined(i386)
+ return ValidSymbol(INTRHAND_SYM_INDEX) && ValidSymbol(INTRSTRAY_SYM_INDEX);
+ #elif defined (XOSVIEW_OPENBSD) && defined(pc532)
+ return ValidSymbol(IVP_SYM_INDEX);
+ #else
return ValidSymbol(INTRCNT_SYM_INDEX) && ValidSymbol(EINTRCNT_SYM_INDEX);
+ #endif
}
+ #if !defined(XOSVIEW_OPENBSD) || !(defined(pc532) || defined(i386))
int BSDNumInts() {
int nintr;
OpenKDIfNeeded();
***************
*** 471,476 ****
--- 501,507 ----
# endif
#endif
}
+ #endif /* XOSVIEW_OPENBSD */
void
BSDGetIntrStats (unsigned long intrCount[NUM_INTR])
***************
*** 496,507 ****
--- 527,574 ----
// counts. We'll just use the intrcnt array here. If anyone
// has problems, please mail me. bgrayson
{
+ #if defined(XOSVIEW_OPENBSD) && (defined(pc532) || defined(i386))
+ # ifdef i386
+ struct intrhand *intrhand[16], *ihp, ih;
+ int intrstray[16];
+
+ safe_kvm_read(nlst[INTRHAND_SYM_INDEX].n_value, intrhand,
+ sizeof(intrhand));
+ safe_kvm_read(nlst[INTRSTRAY_SYM_INDEX].n_value, intrstray,
+ sizeof(intrstray));
+
+ for (int i=0;i<16;i++) {
+ ihp = intrhand[i];
+ intrCount[i] = 0;
+ while (ihp) {
+ if (kvm_read(kd, (u_long)ihp, &ih, sizeof(ih)) != sizeof(ih)) {
+ fprintf(stderr, "Error: kvm_read(): %s\n", kvm_geterr(kd));
+ exit(1);
+ }
+ intrCount[i] = ih.ih_count;
+ ihp = ih.ih_next;
+ }
+ }
+ # endif /* i386 */
+ # ifdef pc532
+ struct iv ivt[32], *ivp = ivt;
+
+ safe_kvm_read(nlst[IVP_SYM_INDEX].n_value, ivp, sizeof(ivt));
+ for (int i=0;i<16;i++,ivp++) {
+ if (ivp->iv_vec && ivp->iv_use)
+ intrCount[i] = ivp->iv_cnt;
+ else
+ intrCount[i] = 0;
+ }
+ # endif /* pc532 */
+ #else /* XOSVIEW_OPENBSD && (pc532 || i386) */
int nintr = BSDNumInts();
safe_kvm_read(nlst[INTRCNT_SYM_INDEX].n_value, kvm_intrcnt,
sizeof(long)*nintr);
for (int i=0;i<nintr;i++) {
intrCount[i] = kvm_intrcnt[i];
}
+ #endif /* XOSVIEW_OPENBSD && (pc532 || i386) */
}
return;
#endif

View File

@ -0,0 +1,30 @@
*** /dev/null Mon Nov 23 09:34:17 1998
--- bsd/obsdintr.h Mon Nov 23 09:39:14 1998
***************
*** 0 ****
--- 1,25 ----
+ #ifndef _OPENBSDINTR_H_
+ #define _OPENBSDINTR_H_
+
+ #ifdef i386
+ struct intrhand {
+ int (*ih_fun) __P((void *));
+ void *ih_arg;
+ u_long ih_count;
+ struct intrhand *ih_next;
+ int ih_level;
+ int ih_irq;
+ char *ih_what;
+ };
+ #endif
+
+ #ifdef pc532
+ struct iv {
+ void (*iv_vec)();
+ void *iv_arg;
+ int iv_cnt;
+ char *iv_use;
+ };
+ #endif
+
+ #endif /* _OPENBSDINTR_H_ */