Chapter 13. OProfile

OProfile is a low overhead, system-wide profiler that uses the performance-monitoring hardware on the processor to retrieve information about the kernel and executables on the system, such as when memory is referenced, the number of level 2 cache (L2) requests, and the number of hardware interrupts received. It consists of a configuration utility, a daemon for collecting data, and a number of tools that can be used to transform the data into a human-readable form. For a complete list of tools that are distributed with the Red Hat Developer Toolset version of OProfile, see Table 13.1, “Tools Distributed with OProfile for Red Hat Developer Toolset”.
OProfile profiles an application without adding any instrumentation by recording the details of every nth event. This allows it to consume fewer resources than Valgrind, but it also causes its samples to be less precise. Unlike Valgrind, which only collects data for a single process and its children in user-space, OProfile is well suited to collect system-wide data on both user-space and kernel-space processes, and requires root privileges to run.
Red Hat Developer Toolset is distributed with OProfile 0.9.9. This version is more recent than the version included in Red Hat Enterprise Linux and provides numerous bug fixes and enhancements.

Table 13.1. Tools Distributed with OProfile for Red Hat Developer Toolset

Name Description
oprofiled The OProfile daemon that collects profiling data.
opcontrol Starts, stops, and configures the OProfile daemon.
opannotate Generates an annotated source file or assembly listing from the profiling data.
oparchive Generates a directory containing executable, debug, and sample files.
opgprof Generates a summary of a profiling session in a format compatible with gprof.
ophelp Displays a list of available events.
opimport Converts a sample database file from a foreign binary format to the native format.
opjitconv Converts a just-in-time (JIT) dump file to the Executable and Linkable Format (ELF).
opreport Generates image and symbol summaries of a profiling session.
ocount A new tool for counting the number of times particular events occur during the duration of a monitored command.