timer stats: speedups

Make timer-stats have almost zero overhead when enabled in the config but
not used.  (this way distros can enable it more easily)

Also update the documentation about overhead of timer_stats - it was
written for the first version which had a global lock and a linear list
walk based lookup ;-)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Ingo Molnar
2007-06-01 00:47:16 -07:00
committed by Linus Torvalds
parent 9fcc15ec3c
commit c1a834dc70
3 changed files with 14 additions and 5 deletions

View File

@ -236,10 +236,15 @@ void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
/*
* It doesnt matter which lock we take:
*/
spinlock_t *lock = &per_cpu(lookup_lock, raw_smp_processor_id());
spinlock_t *lock;
struct entry *entry, input;
unsigned long flags;
if (likely(!active))
return;
lock = &per_cpu(lookup_lock, raw_smp_processor_id());
input.timer = timer;
input.start_func = startf;
input.expire_func = timerf;