Commit 1f2376cd authored by Kan Liang's avatar Kan Liang Committed by Peter Zijlstra
Browse files

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: default avatarKan Liang <kan.liang@linux.intel.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20231025201626.3000228-3-kan.liang@linux.intel.com
parent 85846b27
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;

	/*
+5 −0
Original line number Diff line number Diff line
@@ -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,