kernel: Measure time spent in interrupt handlers

This commit is contained in:
Pawel Dziepak
2013-11-18 01:50:37 +01:00
parent 6a164daad4
commit 955c7edec2
3 changed files with 15 additions and 3 deletions
+2
View File
@@ -60,6 +60,8 @@ typedef struct cpu_ent {
// keeping track of CPU activity
bigtime_t active_time;
bigtime_t irq_time;
bigtime_t interrupt_time;
bigtime_t last_kernel_time;
bigtime_t last_user_time;
+9 -1
View File
@@ -243,6 +243,10 @@ int_io_interrupt_handler(int vector, bool levelTriggered)
bigtime_t start = system_time();
// exceptions and syscalls have their own handlers
ASSERT(sVectors[vector].type != INTERRUPT_TYPE_EXCEPTION
&& sVectors[vector].type != INTERRUPT_TYPE_SYSCALL);
if (!sVectors[vector].no_lock_vector)
acquire_spinlock(&sVectors[vector].vector_lock);
@@ -322,9 +326,13 @@ int_io_interrupt_handler(int vector, bool levelTriggered)
release_spinlock(&sVectors[vector].vector_lock);
SpinLocker locker(sVectors[vector].load_lock);
sVectors[vector].last_measure_active += system_time() - start;
bigtime_t deltaTime = system_time() - start;
sVectors[vector].last_measure_active += deltaTime;
locker.Unlock();
atomic_add64(&get_cpu_struct()->interrupt_time, deltaTime);
if (sVectors[vector].type == INTERRUPT_TYPE_IRQ)
atomic_add64(&get_cpu_struct()->irq_time, deltaTime);
update_int_load(vector);
if (levelTriggered)
+4 -2
View File
@@ -50,10 +50,12 @@ dump_info(int argc, char **argv)
__VERSION__);
kprintf("revision: %s\n\n", get_haiku_revision());
kprintf("cpu count: %" B_PRId32 ", active times:\n", smp_get_num_cpus());
kprintf("cpu count: %" B_PRId32 "\n", smp_get_num_cpus());
for (int32 i = 0; i < smp_get_num_cpus(); i++)
kprintf(" [%" B_PRId32 "] %" B_PRId64 "\n", i + 1, gCPU[i].active_time);
kprintf(" [%" B_PRId32 "] active time: %12" B_PRId64 ", interrupt"
" time: %12" B_PRId64 ", irq time: %12" B_PRId64 "\n", i + 1,
gCPU[i].active_time, gCPU[i].interrupt_time, gCPU[i].irq_time);
// ToDo: Add page_faults
kprintf("pages:\t\t%" B_PRIuPHYSADDR " (%" B_PRIuPHYSADDR " max)\n",