aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-19 12:27:26 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-23 05:42:44 -0400
commitf29ac756a40d0f1bb07d682ea521e7b666ff06d5 (patch)
tree6fabe2f38ae10f824e57fdd5b035ba81b75a71a8 /include/linux
parent3d906ef10a539ff336010afab8f6f9c4fe379695 (diff)
perf_counter: Optimize perf_swcounter_event()
Similar to tracepoints, use an enable variable to reduce overhead when unused. Only look for a counter of a particular event type when we know there is at least one in the system. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/perf_counter.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 89698d8aba5c..e7213e46cf9c 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -669,7 +669,16 @@ static inline int is_software_counter(struct perf_counter *counter)
669 (counter->attr.type != PERF_TYPE_HW_CACHE); 669 (counter->attr.type != PERF_TYPE_HW_CACHE);
670} 670}
671 671
672extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64); 672extern atomic_t perf_swcounter_enabled[PERF_COUNT_SW_MAX];
673
674extern void __perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
675
676static inline void
677perf_swcounter_event(u32 event, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
678{
679 if (atomic_read(&perf_swcounter_enabled[event]))
680 __perf_swcounter_event(event, nr, nmi, regs, addr);
681}
673 682
674extern void __perf_counter_mmap(struct vm_area_struct *vma); 683extern void __perf_counter_mmap(struct vm_area_struct *vma);
675 684