mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 23:11:27 +00:00
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>
This commit is contained in:
parent
3d906ef10a
commit
f29ac756a4
2 changed files with 25 additions and 4 deletions
|
@ -669,7 +669,16 @@ static inline int is_software_counter(struct perf_counter *counter)
|
|||
(counter->attr.type != PERF_TYPE_HW_CACHE);
|
||||
}
|
||||
|
||||
extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
|
||||
extern atomic_t perf_swcounter_enabled[PERF_COUNT_SW_MAX];
|
||||
|
||||
extern void __perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
|
||||
|
||||
static inline void
|
||||
perf_swcounter_event(u32 event, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
|
||||
{
|
||||
if (atomic_read(&perf_swcounter_enabled[event]))
|
||||
__perf_swcounter_event(event, nr, nmi, regs, addr);
|
||||
}
|
||||
|
||||
extern void __perf_counter_mmap(struct vm_area_struct *vma);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue