Skip to content

Commit 1f2376c

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf: Add branch_sample_call_stack
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 85846b2 commit 1f2376c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

arch/x86/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ int x86_pmu_hw_config(struct perf_event *event)
601601
}
602602
}
603603

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

607607
/*

include/linux/perf_event.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,11 @@ static inline bool branch_sample_counters(const struct perf_event *event)
11441144
return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_COUNTERS;
11451145
}
11461146

1147+
static inline bool branch_sample_call_stack(const struct perf_event *event)
1148+
{
1149+
return event->attr.branch_sample_type & PERF_SAMPLE_BRANCH_CALL_STACK;
1150+
}
1151+
11471152
struct perf_sample_data {
11481153
/*
11491154
* Fields set by perf_sample_data_init() unconditionally,

0 commit comments

Comments
 (0)