Skip to content

Commit

Permalink
perf: Add branch_sample_call_stack
Browse files Browse the repository at this point in the history
Add a helper function to check call stack sample type.

The later patch will invoke the function in several places.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20231025201626.3000228-3-kan.liang@linux.intel.com
  • Loading branch information
Kan Liang authored and Peter Zijlstra committed Oct 27, 2023
1 parent 85846b2 commit 1f2376c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/events/core.c
Expand Up @@ -601,7 +601,7 @@ int x86_pmu_hw_config(struct perf_event *event)
}
}

if (event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK)
if (branch_sample_call_stack(event))
event->attach_state |= PERF_ATTACH_TASK_DATA;

/*
Expand Down
5 changes: 5 additions & 0 deletions include/linux/perf_event.h
Expand Up @@ -1144,6 +1144,11 @@ static inline bool branch_sample_counters(const struct perf_event *event)
return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_COUNTERS;
}

static inline bool branch_sample_call_stack(const struct perf_event *event)
{
return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK;
}

struct perf_sample_data {
/*
* Fields set by perf_sample_data_init() unconditionally,
Expand Down

0 comments on commit 1f2376c

Please sign in to comment.