Skip to content

Commit

Permalink
exposing branch misses under macos
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Jan 31, 2024
1 parent 2e3db5f commit a40fc57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion benchmarks/performancecounters/apple_arm_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -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]]};
}
};
Expand Down
9 changes: 8 additions & 1 deletion benchmarks/performancecounters/event_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ struct event_count {
enum event_counter_types {
CPU_CYCLES,
INSTRUCTIONS,
BRANCH_MISSES=2,
BRANCH=4
};

double elapsed_sec() const {
Expand All @@ -49,7 +51,12 @@ struct event_count {
double instructions() const {
return static_cast<double>(event_counts[INSTRUCTIONS]);
}

double branches() const {
return static_cast<double>(event_counts[BRANCH]);
}
double branch_misses() const {
return static_cast<double>(event_counts[BRANCH_MISSES]);
}
event_count& operator=(const event_count& other) {
this->elapsed = other.elapsed;
this->event_counts = other.event_counts;
Expand Down

0 comments on commit a40fc57

Please sign in to comment.