aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/perf_event.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r--include/linux/perf_event.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index dbd18246b36e..3803bb1a862b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -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 */