Implement interrupt counting, so that vmstat -i work.

This commit is contained in:
Olivier Houchard 2004-11-12 21:49:05 +00:00
parent 48321abefe
commit 8e10380a9f
3 changed files with 21 additions and 9 deletions

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <machine/proc.h>
#include <machine/cpufunc.h>
#include <machine/pte.h>
#include <machine/intr.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
@ -109,3 +110,6 @@ ASSYM(P_TRACED, P_TRACED);
ASSYM(P_SIGEVENT, P_SIGEVENT);
ASSYM(P_PROFIL, P_PROFIL);
ASSYM(TRAPFRAMESIZE, sizeof(struct trapframe));
ASSYM(MAXCOMLEN, MAXCOMLEN);
ASSYM(NIRQ, NIRQ);

View File

@ -50,7 +50,10 @@ __FBSDID("$FreeBSD$");
#include <machine/intr.h>
#include <machine/cpu.h>
struct ithd *ithreads[NIRQ];
static struct ithd *ithreads[NIRQ];
static int intrcnt_tab[NIRQ];
static int intrcnt_index = 0;
static int last_printed = 0;
struct arm_intr {
driver_intr_t *handler;
void *arg;
@ -69,7 +72,8 @@ arm_intr_handler(void *arg)
void arm_handler_execute(void *, int);
void arm_setup_irqhandler(const char *name, void (*hand)(void*), void *arg,
void
arm_setup_irqhandler(const char *name, void (*hand)(void*), void *arg,
int irq, int flags, void **cookiep)
{
struct ithd *cur_ith;
@ -87,6 +91,14 @@ void arm_setup_irqhandler(const char *name, void (*hand)(void*), void *arg,
if (error)
return;
ithreads[irq] = cur_ith;
last_printed +=
snprintf(intrnames + last_printed,
MAXCOMLEN + 1,
"irq%d: %s", irq, name);
last_printed++;
intrcnt_tab[irq] = intrcnt_index;
intrcnt_index++;
}
if (!(flags & INTR_FAST)) {
intr->handler = hand;
@ -120,6 +132,7 @@ arm_handler_execute(void *frame, int irqnb)
arm_mask_irqs(irqnb);
while (irqnb != 0) {
i = ffs(irqnb) - 1;
intrcnt[intrcnt_tab[i]]++;
irqnb &= ~(1U << i);
ithd = ithreads[i];
if (!ithd)

View File

@ -102,18 +102,13 @@ ASENTRY_NP(irq_entry)
.align 0
/*
* XXX Provide intrnames/intrcnt for legacy code, but
* don't actually use them.
*/
.global _C_LABEL(intrnames), _C_LABEL(eintrnames)
.global _C_LABEL(intrcnt), _C_LABEL(eintrcnt)
_C_LABEL(intrnames):
.space NIRQ * (MAXCOMLEN + 1)
_C_LABEL(eintrnames):
.global _C_LABEL(intrcnt), _C_LABEL(sintrcnt), _C_LABEL(eintrcnt)
_C_LABEL(intrcnt):
.space NIRQ * 4
_C_LABEL(eintrcnt):
.global _C_LABEL(current_intr_depth)