Chapter 39. OProfile

Chapter 39. OProfile

39.1. Overview of Tools
39.2. Configuring OProfile
39.2.1. Specifying the Kernel
39.2.2. Setting Events to Monitor
39.2.3. Separating Kernel and User-space Profiles
39.3. Starting and Stopping OProfile
39.4. Saving Data
39.5. Analyzing the Data
39.5.1. Using opreport
39.5.2. Using opreport on a Single Executable
39.5.3. Getting more detailed output on the modules
39.5.4. Using opannotate
39.6. Understanding /dev/oprofile/
39.7. Example Usage
39.8. Graphical Interface
39.9. Additional Resources
39.9.1. Installed Docs
39.9.2. Useful Websites

OProfile is a low overhead, system-wide performance monitoring tool. It 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 L2 cache requests, and the number of hardware interrupts received. On a Red Hat Enterprise Linux system, the oprofile RPM package must be installed to use this tool.

Many processors include dedicated performance monitoring hardware. This hardware makes it possible to detect when certain events happen (such as the requested data not being in cache). The hardware normally takes the form of one or more counters that are incremented each time an event takes place. When the counter value, essentially rolls over, an interrupt is generated, making it possible to control the amount of detail (and therefore, overhead) produced by performance monitoring.

OProfile uses this hardware (or a timer-based substitute in cases where performance monitoring hardware is not present) to collect samples of performance-related data each time a counter generates an interrupt. These samples are periodically written out to disk; later, the data contained in these samples can then be used to generate reports on system-level and application-level performance.

OProfile is a useful tool, but be aware of some limitations when using it:

Note: This documentation is provided {and copyrighted} by Red Hat®, Inc. and is released via the Open Publication License. The copyright holder has added the further requirement that Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. The CentOS project redistributes these original works (in their unmodified form) as a reference for CentOS-5 because CentOS-5 is built from publicly available, open source SRPMS. The documentation is unmodified to be compliant with upstream distribution policy. Neither CentOS-5 nor the CentOS Project are in any way affiliated with or sponsored by Red Hat®, Inc.