#include "kernel/interrupt.h"
#include <minix/u64.h>
#include "glo.h"
+#include "profile.h"
#ifdef CONFIG_APIC
if (is_idle)
restart_local_timer();
+
+ if (sprofiling)
+ get_cpulocal_var(idle_interrupted) = 1;
}
PUBLIC u64_t ms_2_cpu_time(unsigned ms)
mov %ebp, %eax
ret
+ENTRY(interrupts_enable)
+ sti
+ ret
+
+ENTRY(interrupts_disable)
+ cli
+ ret
+
/*
* void switch_k_stack(void * esp, void (* continuation)(void));
DECLARE_CPULOCAL(struct proc *, run_q_tail[NR_SCHED_QUEUES]); /* ptrs to ready list tails */
DECLARE_CPULOCAL(int, cpu_is_idle); /* let the others know that you are idle */
+DECLARE_CPULOCAL(volatile int, idle_interrupted); /* to interrupt busy-idle
+ while profiling */
+
DECLARE_CPULOCAL(u64_t ,tsc_ctr_switch); /* when did we switched time accounting */
/* last values read from cpu when sending ooq msg to scheduler */
#include "vm.h"
#include "clock.h"
#include "spinlock.h"
+#include "profile.h"
#include "arch_proto.h"
/* start accounting for the idle time */
context_stop(proc_addr(KERNEL));
- halt_cpu();
+ if (!sprofiling)
+ halt_cpu();
+ else {
+ volatile int * v;
+
+ v = get_cpulocal_var_ptr(idle_interrupted);
+ interrupts_enable();
+ while (!*v)
+ arch_pause();
+ interrupts_disable();
+ *v = 0;
+ }
/*
* end of accounting for the idle task does not happen here, the kernel
* is handling stuff for quite a while before it gets back here!
_PROTOTYPE( void enable_irq, (const irq_hook_t *hook) );
_PROTOTYPE( int disable_irq, (const irq_hook_t *hook) );
+_PROTOTYPE(void interrupts_enable, (void));
+_PROTOTYPE(void interrupts_disable, (void));
+
/* debug.c */
_PROTOTYPE( int runqueues_ok, (void) );
#ifndef CONFIG_SMP