Table of Contents
This manual applies to OProfile version 0.9.6. OProfile is a profiling system for Linux 2.2/2.4/2.6 systems on a number of architectures. It is capable of profiling all parts of a running system, from the kernel (including modules and interrupt handlers) to shared libraries to binaries. It runs transparently in the background collecting information at a low overhead. These features make it ideal for profiling entire systems to determine bottle necks in real-world systems.
Many CPUs provide "performance counters", hardware registers that can count "events"; for example, cache misses, or CPU cycles. OProfile provides profiles of code based on the number of these occurring events: repeatedly, every time a certain (configurable) number of events has occurred, the PC value is recorded. This information is aggregated into profiles for each binary image.
Some hardware setups do not allow OProfile to use performance counters: in these cases, no events are available, and OProfile operates in timer/RTC mode, as described in later chapters.
OProfile is useful in a number of situations. You might want to use OProfile when you :
need low overhead
cannot use highly intrusive profiling methods
need to profile interrupt handlers
need to profile an application and its shared libraries
need to profile dynamically compiled code of supported virtual machines (see Section 1.1, “Support for dynamically compiled (JIT) code”)
need to capture the performance behaviour of entire system
want to examine hardware effects such as cache misses
want detailed source annotation
want instruction-level profiles
want call-graph profiles
OProfile is not a panacea. OProfile might not be a complete solution when you :
require call graph profiles on platforms other than 2.6/x86
don't have root permissions
require 100% instruction-accurate profiles
need function call counts or an interstitial profiling API
cannot tolerate any disturbance to the system whatsoever
need to profile interpreted or dynamically compiled code of non-supported virtual machines
Older versions of OProfile were not capable of attributing samples to symbols from dynamically compiled code, i.e. "just-in-time (JIT) code". Typical JIT compilers load the JIT code into anonymous memory regions. OProfile reported the samples from such code, but the attribution provided was simply:
"anon: <tgid><address range>" |
Due to this limitation, it wasn't possible to profile applications executed by virtual machines (VMs) like the Java Virtual Machine. OProfile now contains an infrastructure to support JITed code. A development library is provided to allow developers to add support for any VM that produces dynamically compiled code (see the OProfile JIT agent developer guide). In addition, built-in support is included for the following:
For information on how to use OProfile's JIT support, see Section 2, “Setting up the JIT profiling feature”.