kernel: Measure time spent in interrupt handlers
This commit is contained in:
@@ -60,6 +60,8 @@ typedef struct cpu_ent {
|
|||||||
|
|
||||||
// keeping track of CPU activity
|
// keeping track of CPU activity
|
||||||
bigtime_t active_time;
|
bigtime_t active_time;
|
||||||
|
bigtime_t irq_time;
|
||||||
|
bigtime_t interrupt_time;
|
||||||
bigtime_t last_kernel_time;
|
bigtime_t last_kernel_time;
|
||||||
bigtime_t last_user_time;
|
bigtime_t last_user_time;
|
||||||
|
|
||||||
|
|||||||
@@ -243,6 +243,10 @@ int_io_interrupt_handler(int vector, bool levelTriggered)
|
|||||||
|
|
||||||
bigtime_t start = system_time();
|
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)
|
if (!sVectors[vector].no_lock_vector)
|
||||||
acquire_spinlock(&sVectors[vector].vector_lock);
|
acquire_spinlock(&sVectors[vector].vector_lock);
|
||||||
|
|
||||||
@@ -322,9 +326,13 @@ int_io_interrupt_handler(int vector, bool levelTriggered)
|
|||||||
release_spinlock(&sVectors[vector].vector_lock);
|
release_spinlock(&sVectors[vector].vector_lock);
|
||||||
|
|
||||||
SpinLocker locker(sVectors[vector].load_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();
|
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);
|
update_int_load(vector);
|
||||||
|
|
||||||
if (levelTriggered)
|
if (levelTriggered)
|
||||||
|
|||||||
@@ -50,10 +50,12 @@ dump_info(int argc, char **argv)
|
|||||||
__VERSION__);
|
__VERSION__);
|
||||||
kprintf("revision: %s\n\n", get_haiku_revision());
|
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++)
|
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
|
// ToDo: Add page_faults
|
||||||
kprintf("pages:\t\t%" B_PRIuPHYSADDR " (%" B_PRIuPHYSADDR " max)\n",
|
kprintf("pages:\t\t%" B_PRIuPHYSADDR " (%" B_PRIuPHYSADDR " max)\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user