Skip to content

Commit 87561af

Browse files
jiegecjannau
authored andcommitted
drivers/perf: apple_m1: Add mapping for branch counters
Apple released their performance counters definition in /usr/share/kpep/a14.plist file on macOS. The file lists the branch counters (number of branch instructions and branch mispredictions): "INST_BRANCH" => { "counters_mask" => 224 "description" => "Retired branch instructions including calls and returns" "number" => 141 } and "BRANCH_MISPRED_NONSPEC" => { "counters_mask" => 224 "description" => "Retired branch instructions including calls and returns that mispredicted" "number" => 203 } In this commit, the performance counters numbered 0x8d(141) and 0xcb(203) are renamed to their actual names and the mappings from generalized performence event types in `enum perf_hw_id` to hardware performance counters are added respectively. Signed-off-by: Jiajie Chen <c@jia.je>
1 parent ac5bb37 commit 87561af

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/perf/apple_m1_cpu_pmu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ static const unsigned m1_pmu_perf_map[PERF_COUNT_HW_MAX] = {
168168
PERF_MAP_ALL_UNSUPPORTED,
169169
[PERF_COUNT_HW_CPU_CYCLES] = M1_PMU_PERFCTR_CORE_ACTIVE_CYCLE,
170170
[PERF_COUNT_HW_INSTRUCTIONS] = M1_PMU_PERFCTR_INST_ALL,
171+
[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = M1_PMU_PERFCTR_INST_BRANCH,
172+
[PERF_COUNT_HW_BRANCH_MISSES] = M1_PMU_PERFCTR_BRANCH_MISPRED_NONSPEC,
171173
};
172174

173175
/* sysfs definitions */

0 commit comments

Comments
 (0)