How perf(1) works, or asking my CPU about their feelings.
Perf is a performance analysis tool for Linux. It instrumentalizes events setup by the kernel to monitor applications. While it makes sense that kernel events are available to a tool implemented inside the kernel, how can perf know about CPU metrics, such as the number of instructions a program executed?