What is Performance counter?
A hardware counter in the CPU that tallies events such as instructions executed, cache misses and branch mispredictions.
Japanese name: 性能カウンタ
A hardware counter in the CPU that tallies events such as instructions executed, cache misses and branch mispredictions.
Japanese name: 性能カウンタ
A CPU's performance monitoring unit (PMU) has dedicated counters for things like cycles plus a small number of general-purpose counters whose event can be selected. In counting mode, the selected events are totaled while the program runs and reported at the end, as Linux perf stat does. In sampling mode, the counter raises an interrupt each time it reaches a set count, and the address of the instruction running at that moment is recorded. Aggregating those samples shows where events occur, such as which functions incur the most cache misses.
Ratios say more than raw counts. A low IPC, instructions divided by cycles, shows that the CPU spends much of its time waiting. Adding cache misses per thousand instructions (MPKI) and the branch misprediction rate helps tell whether the waiting comes from memory or from branches. The available events differ between CPU designs, and events with the same name may be counted differently, so care is needed when comparing numbers across CPUs.
Because general-purpose counters are few, requesting many events at once makes the OS time-multiplex the counters and scale the results into estimates. The address recorded by sampling may also be a few instructions away from the one that caused the event, an effect called skid; some CPUs offer precise sampling features that record the exact address. Programming the counters requires privilege, so ordinary programs use them through an OS interface such as Linux perf_event.
Answer: A. Instructions executed, cache misses, branch mispredictions and the like
Performance counters are hardware counters that tally various events inside the CPU. Cycle and instruction counts give IPC, and counts of cache misses at each level, TLB misses, branch mispredictions and more are available. Tools such as Linux perf collect them while a program runs, providing clues to whether time is going to memory, branches or the computation itself.
Answer: A. The CPU spends much time stalled on memory; change data layout or apply blocking to use caches effectively
Many CPUs can execute several instructions per cycle, so an IPC of 0.3 means they are waiting most of the time. Many last-level cache misses suggest long waits for data from main memory. Effective remedies reduce cache misses: laying data out at consecutive addresses, reordering loops, or blocking so data is reused many times.
Performance counter appears in 8 practice questions across 2 topics, including Performance Analysis, Memory Hierarchy.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.