xref: /linux/tools/perf/arch/arm64/util/mem-events.c (revision bb65acdc832ec84fa42d752c50247e968381d057)
140714c58SLeo Yan // SPDX-License-Identifier: GPL-2.0
2*bb65acdcSKan Liang #include "util/map_symbol.h"
3*bb65acdcSKan Liang #include "util/mem-events.h"
440714c58SLeo Yan #include "mem-events.h"
540714c58SLeo Yan 
640714c58SLeo Yan #define E(t, n, s) { .tag = t, .name = n, .sysfs_name = s }
740714c58SLeo Yan 
8*bb65acdcSKan Liang struct perf_mem_event perf_mem_events_arm[PERF_MEM_EVENTS__MAX] = {
962e6eb8dSLeo Yan 	E("spe-load",	"arm_spe_0/ts_enable=1,pa_enable=1,load_filter=1,store_filter=0,min_latency=%u/",	"arm_spe_0"),
1062e6eb8dSLeo Yan 	E("spe-store",	"arm_spe_0/ts_enable=1,pa_enable=1,load_filter=0,store_filter=1/",			"arm_spe_0"),
1162e6eb8dSLeo Yan 	E("spe-ldst",	"arm_spe_0/ts_enable=1,pa_enable=1,load_filter=1,store_filter=1,min_latency=%u/",	"arm_spe_0"),
1240714c58SLeo Yan };
1340714c58SLeo Yan 
1440714c58SLeo Yan static char mem_ev_name[100];
1540714c58SLeo Yan 
1640714c58SLeo Yan struct perf_mem_event *perf_mem_events__ptr(int i)
1740714c58SLeo Yan {
1840714c58SLeo Yan 	if (i >= PERF_MEM_EVENTS__MAX)
1940714c58SLeo Yan 		return NULL;
2040714c58SLeo Yan 
21*bb65acdcSKan Liang 	return &perf_mem_events_arm[i];
2240714c58SLeo Yan }
2340714c58SLeo Yan 
24c091ee90SIan Rogers const char *perf_mem_events__name(int i, const char *pmu_name __maybe_unused)
2540714c58SLeo Yan {
2640714c58SLeo Yan 	struct perf_mem_event *e = perf_mem_events__ptr(i);
2740714c58SLeo Yan 
2840714c58SLeo Yan 	if (i >= PERF_MEM_EVENTS__MAX)
2940714c58SLeo Yan 		return NULL;
3040714c58SLeo Yan 
3140714c58SLeo Yan 	if (i == PERF_MEM_EVENTS__LOAD || i == PERF_MEM_EVENTS__LOAD_STORE)
3240714c58SLeo Yan 		scnprintf(mem_ev_name, sizeof(mem_ev_name),
3340714c58SLeo Yan 			  e->name, perf_mem_events__loads_ldlat);
3440714c58SLeo Yan 	else /* PERF_MEM_EVENTS__STORE */
3540714c58SLeo Yan 		scnprintf(mem_ev_name, sizeof(mem_ev_name), e->name);
3640714c58SLeo Yan 
3740714c58SLeo Yan 	return mem_ev_name;
3840714c58SLeo Yan }
39