Performance Events for Linux, called “PERF,” is the standard profiling infrastructure on Linux. PERF consists of a kernel SYSCALL to collect performance data and a suite of user-space tools (linux-tools). Most users want to analyze program performance and concentrate on the off-the-shelf tools for performance measurement and profiling. You can, however, dig deeper and use the PERF SYSCALL to build a tool of your own.

The PERF-related pages show how to use PERF on Raspberry Pi. If you haven’t used PERF before, then you should start with the PERF tutorial about finding hot spots in code. All of the techniques can be applied on other Linux platforms including x86.

The PERF tutorial has three parts.

  • Part 1 demonstrates how to use PERF to identify and analyze the hottest execution spots in a program. Part 1 covers the basic PERF commands, options and software performance events.
  • Part 2 introduces hardware performance events and demonstrates how to measure hardware events across an entire application.
  • Part 3 uses hardware performance event sampling to identify and analyze hot spots within an application program.

In addition to demonstrating PERF, the tutorial discusses derived ratios and rates such as instructions per cycle (IPC) to assess performance and to identify issues. Derived metrics are easier to understand and apply than raw event counts.

It helps to know about the underlying machine micro-architecture when analyzing profiles and tuning code. Be sure to check out my short summaries of ARM11 and ARMv7 (Cortex-A7) micro-architecture, too.

One thought on “PERF

  1. Pingback: A very good introduction to Perf | Yunming Zhang's Blog

Comments are closed.