4 ms·
How does the benchmark tell how many branches were mispredicted? Is that something the processor exposes?
by piinbinary 7mo ago
How does the benchmark tell how many branches were mispredicted? Is that something the processor exposes?
- ErikCorry 7mo agoYeah performance counters
- cloudbonsai 7mo agoTo fill in the details, here is the code used for the measurement: https://github.com/lemire/counters/blob/main/include/counters/event_counter.h#L124-L130 https://github.com/lemire/counters/blob/main/include/counter... It fetches the number of mispredicted instructions from Linux's perf subsystem, which in turn gathers the metrics from CPU's PMU (Performance Monitoring Unit) interface.