[kernel] clean up the thread_stats stuff a bit to remove some #ifdefs
This commit is contained in:
@@ -225,6 +225,12 @@ struct thread_stats {
|
||||
|
||||
extern struct thread_stats thread_stats;
|
||||
|
||||
#define THREAD_STATS_INC(name) do { thread_stats.name++; } while(0)
|
||||
|
||||
#else
|
||||
|
||||
#define THREAD_STATS_INC(name) do { } while (0)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -293,9 +293,7 @@ void thread_resched(void)
|
||||
ASSERT(in_critical_section());
|
||||
#endif
|
||||
|
||||
#if THREAD_STATS
|
||||
thread_stats.reschedules++;
|
||||
#endif
|
||||
THREAD_STATS_INC(reschedules);
|
||||
|
||||
oldthread = current_thread;
|
||||
|
||||
@@ -343,7 +341,7 @@ void thread_resched(void)
|
||||
}
|
||||
|
||||
#if THREAD_STATS
|
||||
thread_stats.context_switches++;
|
||||
THREAD_STATS_INC(context_switches);
|
||||
|
||||
if (oldthread == idle_thread) {
|
||||
bigtime_t now = current_time_hires();
|
||||
@@ -395,9 +393,7 @@ void thread_yield(void)
|
||||
|
||||
enter_critical_section();
|
||||
|
||||
#if THREAD_STATS
|
||||
thread_stats.yields++;
|
||||
#endif
|
||||
THREAD_STATS_INC(yields);
|
||||
|
||||
/* we are yielding the cpu, so stick ourselves into the tail of the run queue and reschedule */
|
||||
current_thread->state = THREAD_READY;
|
||||
@@ -434,7 +430,7 @@ void thread_preempt(void)
|
||||
|
||||
#if THREAD_STATS
|
||||
if (current_thread != idle_thread)
|
||||
thread_stats.preempts++; /* only track when a meaningful preempt happens */
|
||||
THREAD_STATS_INC(preempts); /* only track when a meaningful preempt happens */
|
||||
#endif
|
||||
|
||||
/* we are being preempted, so we get to go back into the front of the run queue if we have quantum left */
|
||||
|
||||
@@ -207,9 +207,7 @@ static enum handler_return timer_tick(void *arg, time_t now)
|
||||
timer_t *timer;
|
||||
enum handler_return ret = INT_NO_RESCHEDULE;
|
||||
|
||||
#if THREAD_STATS
|
||||
thread_stats.timer_ints++;
|
||||
#endif
|
||||
THREAD_STATS_INC(timer_ints);
|
||||
|
||||
LTRACEF("now %d, sp 0x%x\n", now, __GET_FRAME());
|
||||
|
||||
@@ -229,9 +227,7 @@ static enum handler_return timer_tick(void *arg, time_t now)
|
||||
|
||||
LTRACEF("dequeued timer %p, scheduled %d periodic %d\n", timer, timer->scheduled_time, timer->periodic_time);
|
||||
|
||||
#if THREAD_STATS
|
||||
thread_stats.timers++;
|
||||
#endif
|
||||
THREAD_STATS_INC(timers);
|
||||
|
||||
bool periodic = timer->periodic_time > 0;
|
||||
|
||||
|
||||
@@ -83,9 +83,7 @@ enum handler_return platform_irq(struct arm_iframe *frame)
|
||||
if (vector == 0xffffffff)
|
||||
return INT_NO_RESCHEDULE;
|
||||
|
||||
#if THREAD_STATS
|
||||
thread_stats.interrupts++;
|
||||
#endif
|
||||
THREAD_STATS_INC(interrupts);
|
||||
|
||||
// printf("platform_irq: spsr 0x%x, pc 0x%x, currthread %p, vector %d\n", frame->spsr, frame->pc, current_thread, vector);
|
||||
|
||||
|
||||
@@ -123,9 +123,7 @@ enum handler_return platform_irq(struct arm_iframe *frame)
|
||||
|
||||
// TRACEF("spsr 0x%x, pc 0x%x, currthread %p, vector %d, handler %p\n", frame->spsr, frame->pc, current_thread, vector, int_handler_table[vector].handler);
|
||||
|
||||
#if THREAD_STATS
|
||||
thread_stats.interrupts++;
|
||||
#endif
|
||||
THREAD_STATS_INC(interrupts);
|
||||
|
||||
// deliver the interrupt
|
||||
enum handler_return ret;
|
||||
|
||||
@@ -138,9 +138,7 @@ enum handler_return platform_irq(struct arm_iframe *frame)
|
||||
// get the current vector
|
||||
unsigned int vector;
|
||||
|
||||
#if THREAD_STATS
|
||||
thread_stats.interrupts++;
|
||||
#endif
|
||||
THREAD_STATS_INC(interrupts);
|
||||
|
||||
// read from the first level int handler
|
||||
vector = *ICReg(0, INTCON_SIR_IRQ);
|
||||
|
||||
@@ -201,13 +201,11 @@ enum handler_return platform_irq(struct x86_iframe *frame)
|
||||
// get the current vector
|
||||
unsigned int vector = frame->vector;
|
||||
|
||||
#if THREAD_STATS
|
||||
thread_stats.interrupts++;
|
||||
#endif
|
||||
|
||||
THREAD_STATS_INC(interrupts);
|
||||
|
||||
// deliver the interrupt
|
||||
enum handler_return ret = INT_NO_RESCHEDULE;
|
||||
|
||||
|
||||
switch (vector) {
|
||||
case INT_GP_FAULT:
|
||||
x86_gpf_handler(frame);
|
||||
|
||||
Reference in New Issue
Block a user