[PATCH] perf record ibs: Define macros for IBS L3MissOnly bits

From: Ravi Bangoria
Date: Fri Jun 03 2022 - 00:49:01 EST


Instead of magic numbers use macros for IBS L3MissOnly bits.

Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxx>
---
tools/perf/arch/x86/util/evsel.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/arch/x86/util/evsel.c b/tools/perf/arch/x86/util/evsel.c
index fceb904902ab..53763e583804 100644
--- a/tools/perf/arch/x86/util/evsel.c
+++ b/tools/perf/arch/x86/util/evsel.c
@@ -7,6 +7,9 @@
#include "linux/string.h"
#include "util/debug.h"

+#define IBS_FETCH_L3MISSONLY (1ULL << 59)
+#define IBS_OP_L3MISSONLY (1ULL << 16)
+
void arch_evsel__set_sample_weight(struct evsel *evsel)
{
evsel__set_sample_bit(evsel, WEIGHT_STRUCT);
@@ -98,12 +101,12 @@ void arch__post_evsel_config(struct evsel *evsel, struct perf_event_attr *attr)
ibs_op_pmu = perf_pmu__find("ibs_op");

if (ibs_fetch_pmu && ibs_fetch_pmu->type == evsel_pmu->type) {
- if (attr->config & (1ULL << 59)) {
+ if (attr->config & IBS_FETCH_L3MISSONLY) {
ibs_l3miss_warn();
warned_once = 1;
}
} else if (ibs_op_pmu && ibs_op_pmu->type == evsel_pmu->type) {
- if (attr->config & (1ULL << 16)) {
+ if (attr->config & IBS_OP_L3MISSONLY) {
ibs_l3miss_warn();
warned_once = 1;
}
--
2.31.1