4 ms·
It's not a trace in the ptrace sense. Last I checked it uses clock based samples or hardware-native performance counters, depending on what's useful. The resul
by wyldfire 5y ago
It's not a trace in the ptrace sense. Last I checked it uses clock based samples or hardware-native performance counters, depending on what's useful. The results are incredibly useful but the process is somewhat 'simple' IMO. Imagine an ISR from a clock source that records the PC. Ok, it's not quite that simple but it's what is at the core.
One thing that can be confusing is that programs that do some I/O and/or IPC -- it won't be counted, and sometimes perf will point to the 'wrong' bottleneck. That's why it's helpful to understand the tool's design. Intel's perf counter was called something like "CLK_UNHALTED" back in the day and that was helpful to remind you exactly what was being measured. If your program is slow because of the computation/memory access etc, it's perfect.
- R0b0t1 5y agoIt does two things (or three, but all of which use the same hardware). PC sampling, and counters that tick on specific events. The events can be processor instruction related, like cache misses, or kernel events.