mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
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 <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
1 parent
cfbcf46845
commit
3b1fff0803
9 files changed
+18
-17
No files matched your search
@@ -64,6 +64,7 @@ struct perf_callchain_entry {
|
||||
struct perf_callchain_entry_ctx {
|
||||
struct perf_callchain_entry *entry;
|
||||
u32 max_stack;
|
||||
u32 nr;
|
||||
};
|
||||
|
||||
struct perf_raw_record {
|
||||
@@ -1080,9 +1081,10 @@ extern int sysctl_perf_event_max_stack;
|
||||
|
||||
static inline int perf_callchain_store(struct perf_callchain_entry_ctx *ctx, u64 ip)
|
||||
{
|
||||
struct perf_callchain_entry *entry = ctx->entry;
|
||||
if (entry->nr < ctx->max_stack) {
|
||||
if (ctx->nr < ctx->max_stack) {
|
||||
struct perf_callchain_entry *entry = ctx->entry;
|
||||
entry->ip[entry->nr++] = ip;
|
||||
++ctx->nr;
|
||||
return 0;
|
||||
} else {
|
||||
return -1; /* no more room, stop walking the stack */
|
||||
|
||||
Reference in new issue
Block a user