git: 3c01f7415067 - stable/13 - libpmc: add some AMD pmu counter aliases

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Fri, 15 Oct 2021 15:26:14 UTC
The branch stable/13 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=3c01f7415067d8a4da0737eb74c2709f0d5afed8

commit 3c01f7415067d8a4da0737eb74c2709f0d5afed8
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2021-09-30 14:13:37 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2021-10-15 15:21:36 +0000

    libpmc: add some AMD pmu counter aliases
    
    Make it mostly compatible with what's defined for Intel. Except where
    noted, these are defined for all of amdzen(1|2|3).
    
    Reviewed by:    emaste
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D32162
    
    (cherry picked from commit a20c10893eb17e281f119d1b9b39c175dbf4d7bd)
---
 lib/libpmc/libpmc_pmu_util.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c
index b72f45e85a72..363f93c591f8 100644
--- a/lib/libpmc/libpmc_pmu_util.c
+++ b/lib/libpmc/libpmc_pmu_util.c
@@ -86,6 +86,19 @@ static struct pmu_alias pmu_intel_alias_table[] = {
 static struct pmu_alias pmu_amd_alias_table[] = {
 	{"UNHALTED_CORE_CYCLES", "ls_not_halted_cyc"},
 	{"UNHALTED-CORE-CYCLES", "ls_not_halted_cyc"},
+	{"LLC_MISSES", "l3_comb_clstr_state.request_miss"},
+	{"LLC-MISSES", "l3_comb_clstr_state.request_miss"},
+	{"LLC_REFERENCE", "l3_request_g1.caching_l3_cache_accesses"},
+	{"LLC-REFERENCE", "l3_request_g1.caching_l3_cache_accesses"},
+	{"BRANCH_INSTRUCTION_RETIRED", "ex_ret_brn"},
+	{"BRANCH-INSTRUCTION-RETIRED", "ex_ret_brn"},
+	{"BRANCH_MISSES_RETIRED", "ex_ret_brn_misp"},
+	{"BRANCH-MISSES-RETIRED", "ex_ret_brn_misp"},
+	{"unhalted-cycles", "ls_not_halted_cyc"},
+	{"instructions", "ex_ret_instr",},
+	{"branch-mispredicts", "ex_ret_brn_misp"},
+	{"branches", "ex_ret_brn"},
+	{"interrupts", "ls_int_taken"}, /* Not on amdzen1 */
 	{NULL, NULL},
 };