diff --git a/hermit/arch/x86/include/asm/irq.h b/hermit/arch/x86/include/asm/irq.h index fa4fe612c..29bc5c06a 100644 --- a/hermit/arch/x86/include/asm/irq.h +++ b/hermit/arch/x86/include/asm/irq.h @@ -73,6 +73,10 @@ int irq_uninstall_handler(unsigned int irq); */ int irq_init(void); +/** @brief Print the number of received interrupts + */ +void print_irq_stats(void); + /** @brief Switch from a fix to a dynamic timer period * * @return 0 on success diff --git a/hermit/arch/x86/kernel/apic.c b/hermit/arch/x86/kernel/apic.c index 16ec81e21..df40eadf3 100644 --- a/hermit/arch/x86/kernel/apic.c +++ b/hermit/arch/x86/kernel/apic.c @@ -823,8 +823,11 @@ void shutdown_system(void) if (if_bootprocessor) x2apic_disable(); - if (if_bootprocessor) + if (if_bootprocessor) { + print_irq_stats(); kprintf("System goes down...\n"); + } + flush_cache(); atomic_int32_dec(&cpu_online); diff --git a/hermit/arch/x86/kernel/irq.c b/hermit/arch/x86/kernel/irq.c index b5e87b216..1f670c889 100644 --- a/hermit/arch/x86/kernel/irq.c +++ b/hermit/arch/x86/kernel/irq.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -89,6 +90,7 @@ extern void mmnif_irq(void); * this to handle custom IRQ handlers for a given IRQ */ static void* irq_routines[MAX_HANDLERS] = {[0 ... MAX_HANDLERS-1] = NULL}; +static uint64_t irq_counter[MAX_CORES][MAX_HANDLERS] = {[0 ... MAX_CORES-1][0 ... MAX_HANDLERS-1] = 0}; /* This installs a custom IRQ handler for the given IRQ */ int irq_install_handler(unsigned int irq, irq_handler_t handler) @@ -273,6 +275,8 @@ size_t** irq_handler(struct state *s) /* This is a blank function pointer */ void (*handler) (struct state * s); + irq_counter[CORE_ID][s->int_no]++; + check_workqueues_in_irqhandler(s->int_no); /* @@ -297,3 +301,17 @@ size_t** irq_handler(struct state *s) return ret; } + +void print_irq_stats(void) +{ + uint32_t i, j; + + for(i=0; i