1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

count the interrupts and dump the results during a system shutdown

This commit is contained in:
Stefan Lankes 2016-02-21 17:03:29 +01:00
parent ef87bb3d58
commit 0090f75659
3 changed files with 26 additions and 1 deletions

View file

@ -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

View file

@ -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);

View file

@ -37,6 +37,7 @@
#include <hermit/string.h>
#include <hermit/tasks.h>
#include <hermit/errno.h>
#include <hermit/spinlock.h>
#include <asm/irq.h>
#include <asm/idt.h>
#include <asm/isrs.h>
@ -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<MAX_CORES; i++)
{
for(j=0; j<MAX_HANDLERS; j++)
{
if (irq_counter[i][j])
kprintf("Core %d, IRQ %d: %lld interrupts\n", i, j, irq_counter[i][j]);
}
}
}