perf_counter: executable mmap() information

Currently the profiling information returns userspace IPs but no way
to correlate them to userspace code. Userspace could look into
/proc/$pid/maps but that might not be current or even present anymore
at the time of analyzing the IPs.

Therefore provide means to track the mmap information and provide it
in the output stream.

XXX: only covers mmap()/munmap(), mremap() and mprotect() are missing.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Paul Mackerras <paulus@samba.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Orig-LKML-Reference: <20090330171023.417259499@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Peter Zijlstra
2009-03-30 19:07:05 +02:00
committed by Ingo Molnar
parent 1955643902
commit 0a4a93919b
3 changed files with 177 additions and 2 deletions

View File

@@ -137,9 +137,11 @@ struct perf_counter_hw_event {
exclude_kernel : 1, /* ditto kernel */
exclude_hv : 1, /* ditto hypervisor */
exclude_idle : 1, /* don't count when idle */
include_tid : 1, /* include the tid */
include_tid : 1, /* include the tid */
mmap : 1, /* include mmap data */
munmap : 1, /* include munmap data */
__reserved_1 : 54;
__reserved_1 : 52;
__u32 extra_config_len;
__u32 __reserved_4;
@@ -211,6 +213,9 @@ enum perf_event_type {
PERF_EVENT_IP = 0,
PERF_EVENT_GROUP = 1,
PERF_EVENT_MMAP = 2,
PERF_EVENT_MUNMAP = 3,
__PERF_EVENT_TID = 0x100,
};
@@ -491,6 +496,12 @@ static inline int is_software_counter(struct perf_counter *counter)
extern void perf_swcounter_event(u32, u64, int, struct pt_regs *);
extern void perf_counter_mmap(unsigned long addr, unsigned long len,
unsigned long pgoff, struct file *file);
extern void perf_counter_munmap(unsigned long addr, unsigned long len,
unsigned long pgoff, struct file *file);
#else
static inline void
perf_counter_task_sched_in(struct task_struct *task, int cpu) { }
@@ -511,6 +522,15 @@ static inline int perf_counter_task_enable(void) { return -EINVAL; }
static inline void
perf_swcounter_event(u32 event, u64 nr, int nmi, struct pt_regs *regs) { }
static inline void
perf_counter_mmap(unsigned long addr, unsigned long len,
unsigned long pgoff, struct file *file) { }
static inline void
perf_counter_munmap(unsigned long addr, unsigned long len,
unsigned long pgoff, struct file *file) { }
#endif
#endif /* __KERNEL__ */