OProfile is a system-wide profiler for Linux systems, capable of profiling all running code at low overhead. OProfile is released under the GNU GPL.
It consists of a kernel driver and a daemon for collecting sample data, and several post-profiling tools for turning data into information.
OProfile leverages the hardware performance counters of the CPU to enable profiling of a wide variety of interesting statistics, which can also be used for basic time-spent profiling. All code is profiled: hardware and software interrupt handlers, kernel modules, the kernel, shared libraries, and applications.
OProfile is currently in alpha status; however it has proven stable over a large number of differing configurations; it is being used on machines ranging from laptops to 16-way NUMA-Q boxes.
No special recompilations, wrapper libraries or the like are necessary. Even debug symbols (-g option to gcc) are not necessary unless you want to produce annotated source.
No kernel patch is needed – just insert the module.
All code running on the system is profiled, enabling analysis of system performance.
Performance counter support
Enables collection of various low-level data, and assocation with particular sections of code.
With an x86 or ARM 2.6 kernel, OProfile can provide gprof-style call-graph profiling data.
OProfile has a typical overhead of 1-8%, dependent on sampling frequency and workload.
Profile data can be produced on the function-level or instruction-level detail. Source trees annotated with profile information can be created. A hit list of applications and functions that take the most time across the whole system can be produced.
OProfile works across a range of CPUs, include the Intel range, AMD’s Athlon and AMD64 processors range, the Alpha, ARM, and more. OProfile will work against almost any 2.2, 2.4 and 2.6 kernels, and works on both UP and SMP systems from desktops to the scariest NUMAQ boxes.
First you need to start the opcontrol daemon: opcontrol –start-daemon –no-vmlinux
For a very detailed manual for running oprofile, http://oprofile.sourceforge.net/doc/index.html