diff options
author | Richard Braun <rbraun@sceen.net> | 2014-05-13 08:56:14 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2014-05-13 08:56:14 +0200 |
commit | cad2cddccafbce869127ccd11b33145cc48b41e1 (patch) | |
tree | 5a955fdb26f2b80b8c2db57dcb71e30aeb1606de /kern/thread.c | |
parent | 95876998e4cd3408b4fb235e8b5c799631a05f3f (diff) |
kern/thread: count scheduling interrupts
Diffstat (limited to 'kern/thread.c')
-rw-r--r-- | kern/thread.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/kern/thread.c b/kern/thread.c index 325c4734..47225641 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -205,6 +205,7 @@ struct thread_runq { /* Ticks before the next balancing attempt when a run queue is idle */ unsigned int idle_balance_ticks; + struct evcnt ev_schedule; struct evcnt ev_tick; } __aligned(CPU_L1_SIZE); @@ -353,6 +354,7 @@ static void __init thread_runq_init(struct thread_runq *runq, struct thread *booter) { char name[EVCNT_NAME_SIZE]; + unsigned int runq_id; spinlock_init(&runq->lock); runq->nr_threads = 0; @@ -362,7 +364,10 @@ thread_runq_init(struct thread_runq *runq, struct thread *booter) runq->balancer = NULL; runq->idler = NULL; runq->idle_balance_ticks = (unsigned int)-1; - snprintf(name, sizeof(name), "thread_tick/%u", thread_runq_id(runq)); + runq_id = thread_runq_id(runq); + snprintf(name, sizeof(name), "thread_schedule/%u", runq_id); + evcnt_register(&runq->ev_schedule, name); + snprintf(name, sizeof(name), "thread_tick/%u", runq_id); evcnt_register(&runq->ev_tick, name); } @@ -1976,6 +1981,18 @@ thread_yield(void) } void +thread_schedule_intr(void) +{ + struct thread_runq *runq; + + assert(!cpu_intr_enabled()); + assert(!thread_preempt_enabled()); + + runq = thread_runq_local(); + evcnt_inc(&runq->ev_schedule); +} + +void thread_tick(void) { struct thread_runq *runq; |