$linuxjunkies
>

perf

also: linux perf, perf-tools

perf is a Linux performance analysis tool that allows you to measure CPU cycles, cache misses, branch predictions, and other hardware events to profile and debug application performance.

perf is the standard Linux profiling tool built into the kernel. It uses hardware performance counters and software events to collect detailed information about how programs execute, making it essential for performance optimization and debugging.

You can use perf to record events (perf record), then analyze the results with perf report. For example, perf record -g ./myapp captures CPU samples with call graphs, showing exactly where your program spends time.

perf can track various metrics: CPU cycles, memory access patterns, cache misses, branch mispredictions, and custom kernel events. It generates detailed reports and can integrate with visualization tools like perf-gui or FlameGraph.

Unlike simple profilers, perf has minimal overhead and works at the system level, making it the go-to choice for performance engineers analyzing everything from application bottlenecks to kernel behavior.

Related terms