History

perf core: Separate accounting of contexts and real addresses in a stack trace

The perf_sample->ip_callchain->nr value includes all the entries in the ip_callchain->ip[] array, real addresses and PERF_CONTEXT_{KERNEL,USER,etc}, while what the user expects is that what is in the kernel.perf_event_max_stack sysctl or in the upcoming per event perf_event_attr.sample_max_stack knob be honoured in terms of IP addresses in the stack trace. So allocate a bunch of extra entries for contexts, and do the accounting via perf_callchain_entry_ctx struct members. A new sysctl, kernel.perf_event_max_contexts_per_stack is also introduced for investigating possible bugs in the callchain implementation by some arch.

Arnaldo Carvalho de Melo committed 10 years ago

Commit c85b0331 parent 3e4de4e5 files · +49 −3Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/perf_event.h+1−0
@@ -862,6 +862,7 @@ enum perf_event_type { · 861 unmodified lines
862};862};
863 863
864#define PERF_MAX_STACK_DEPTH 127864#define PERF_MAX_STACK_DEPTH 127
865#define PERF_MAX_CONTEXTS_PER_STACK 8
865 866
866enum perf_callchain_context {867enum perf_callchain_context {
867 PERF_CONTEXT_HV = (__u64)-32,868 PERF_CONTEXT_HV = (__u64)-32,