perf core: Add a 'nr' field to perf_event_callchain_context
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 10 May 2016 21:08:32 +0000 (18:08 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 17 May 2016 02:11:51 +0000 (23:11 -0300)
commit3b1fff08038bd0792b1aa1e9703b2dd0512a3fd0
tree894e513ec904c0b4249917b64adac9d5bda162b5
parentcfbcf468454ab4b20f0b4b62da51920b99fdb19e
perf core: Add a 'nr' field to perf_event_callchain_context

We will use it to count how many addresses are in the entry->ip[] array,
excluding PERF_CONTEXT_{KERNEL,USER,etc} entries, so that we can really
return the number of entries specified by the user via the relevant
sysctl, kernel.perf_event_max_contexts, or via the per event
perf_event_attr.sample_max_stack knob.

This way we keep the perf_sample->ip_callchain->nr meaning, that is the
number of entries, be it real addresses or PERF_CONTEXT_ entries, while
honouring the max_stack knobs, i.e. the end result will be max_stack
entries if we have at least that many entries in a given stack trace.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-s8teto51tdqvlfhefndtat9r@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
arch/arm/kernel/perf_callchain.c
arch/arm64/kernel/perf_callchain.c
arch/metag/kernel/perf_callchain.c
arch/mips/kernel/perf_event.c
arch/powerpc/perf/callchain.c
arch/sparc/kernel/perf_event.c
arch/x86/events/core.c
include/linux/perf_event.h
kernel/events/callchain.c