diff --git a/src/system/kernel/arch/x86/arch_timer.c b/src/system/kernel/arch/x86/arch_timer.c index c1ef853ea4..94578a4818 100644 --- a/src/system/kernel/arch/x86/arch_timer.c +++ b/src/system/kernel/arch/x86/arch_timer.c @@ -25,6 +25,13 @@ #include "interrupts.h" +//#define TRACE_TIMER +#ifdef TRACE_TIMER +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + #define PIT_CLOCK_RATE 1193180 #define PIT_MAX_TIMER_INTERVAL (0xffff * 1000000ll / PIT_CLOCK_RATE) @@ -75,6 +82,7 @@ apic_timer_interrupt(void) void arch_timer_set_hardware_timer(bigtime_t timeout) { + TRACE(("arch_timer_set_hardware_timer: timeout %lld\n", timeout)); // try the apic timer first if (arch_smp_set_apic_timer(timeout) != B_OK) set_isa_hardware_timer(timeout); @@ -84,6 +92,7 @@ arch_timer_set_hardware_timer(bigtime_t timeout) void arch_timer_clear_hardware_timer(void) { + TRACE(("arch_timer_clear_hardware_timer\n")); if (arch_smp_clear_apic_timer() != B_OK) clear_isa_hardware_timer(); } diff --git a/src/system/kernel/timer.c b/src/system/kernel/timer.c index 73c6a1f303..099ebd09a7 100644 --- a/src/system/kernel/timer.c +++ b/src/system/kernel/timer.c @@ -93,6 +93,8 @@ restart_scan: release_spinlock(spinlock); + TRACE(("timer_interrupt: calling hook %p for event %p\n", event->hook, event)); + // call the callback // note: if the event is not periodic, it is ok // to delete the event structure inside the callback @@ -140,6 +142,8 @@ add_timer(timer *event, timer_hook hook, bigtime_t period, int32 flags) if (event == NULL || hook == NULL || period < 0) return B_BAD_VALUE; + TRACE(("add_timer: event %p\n", event)); + scheduleTime = period; if (flags != B_ONE_SHOT_ABSOLUTE_TIMER) scheduleTime += currentTime; @@ -214,6 +218,8 @@ cancel_timer(timer *event) int currentCPU = smp_get_current_cpu(); cpu_status state; + TRACE(("cancel_timer: event %p\n", event)); + state = disable_interrupts(); // walk through all of the cpu's timer queues