From 6f0ede327e95d265539bf1ec6f7e130560f25baf Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 31 Jan 2024 15:15:07 -0500 Subject: [PATCH] exposing branch misses under macos (#587) * exposing branch misses under macos * formatting --- benchmarks/performancecounters/apple_arm_events.h | 2 +- benchmarks/performancecounters/event_counter.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/benchmarks/performancecounters/apple_arm_events.h b/benchmarks/performancecounters/apple_arm_events.h index 088fa1728..608817277 100644 --- a/benchmarks/performancecounters/apple_arm_events.h +++ b/benchmarks/performancecounters/apple_arm_events.h @@ -1102,7 +1102,7 @@ struct AppleEvents { printf("%14s: %llu\n", alias->alias, val); }*/ return performance_counters{ - counters_0[counter_map[0]], counters_0[counter_map[3]], + counters_0[counter_map[0]], counters_0[counter_map[2]], counters_0[counter_map[2]], counters_0[counter_map[1]]}; } }; diff --git a/benchmarks/performancecounters/event_counter.h b/benchmarks/performancecounters/event_counter.h index 63e605690..4a1e5eca3 100644 --- a/benchmarks/performancecounters/event_counter.h +++ b/benchmarks/performancecounters/event_counter.h @@ -35,6 +35,8 @@ struct event_count { enum event_counter_types { CPU_CYCLES, INSTRUCTIONS, + BRANCH_MISSES = 2, + BRANCH = 4 }; double elapsed_sec() const { @@ -49,7 +51,10 @@ struct event_count { double instructions() const { return static_cast(event_counts[INSTRUCTIONS]); } - + double branches() const { return static_cast(event_counts[BRANCH]); } + double branch_misses() const { + return static_cast(event_counts[BRANCH_MISSES]); + } event_count& operator=(const event_count& other) { this->elapsed = other.elapsed; this->event_counts = other.event_counts;