git: 6f50b73ee5c1 - main - libpmc: add armv8 pmu-event aliases

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Wed, 06 Jul 2022 17:32:48 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=6f50b73ee5c11253a35bb2787f2bef627079999d

commit 6f50b73ee5c11253a35bb2787f2bef627079999d
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-07-06 17:30:03 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-07-06 17:32:21 +0000

    libpmc: add armv8 pmu-event aliases
    
    These are all "standard microarchitectural events", which in theory are
    supported by every ARMv8 processor. In practice, it depends on the
    pmu-event definitions being complete and accurate, which they are not
    for every processor. Still, these aliases should be functional on the
    majority of systems.
    
    PR:             254532
    Reported by:    emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D35550
---
 lib/libpmc/libpmc_pmu_util.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c
index 7af6d813ada6..1ae0c573d157 100644
--- a/lib/libpmc/libpmc_pmu_util.c
+++ b/lib/libpmc/libpmc_pmu_util.c
@@ -165,6 +165,21 @@ pmu_alias_get(const char *name)
 #elif defined(__aarch64__)
 
 static struct pmu_alias pmu_armv8_alias_table[] = {
+	{"UNHALTED_CORE_CYCLES", "CPU_CYCLES"},
+	{"UNHALTED-CORE-CYCLES", "CPU_CYCLES"},
+	{"LLC_MISSES", "LL_CACHE_MISS_RD"},
+	{"LLC-MISSES", "LL_CACHE_MISS_RD"},
+	{"LLC_REFERENCE", "LL_CACHE_RD"},
+	{"LLC-REFERENCE", "LL_CACHE_RD"},
+	{"BRANCH_INSTRUCTION_RETIRED", "BR_RETIRED"},
+	{"BRANCH-INSTRUCTION-RETIRED", "BR_RETIRED"},
+	{"BRANCH_MISSES_RETIRED", "BR_MIS_PRED_RETIRED"},
+	{"BRANCH-MISSES-RETIRED", "BR_MIS_PRED_RETIRED"},
+	{"unhalted-cycles", "CPU_CYCLES"},
+	{"instructions", "INST_RETIRED",},
+	{"branch-mispredicts", "BR_MIS_PRED_RETIRED"},
+	{"branches", "BR_RETIRED"},
+	{"interrupts", "EXC_IRQ"},
 	{NULL, NULL},
 };