Introduction to OProfile A System Profiler for Linux Chun-wen Wang
Outline Introduction Features Commands Reference Demo
Introduction OProfile is a system-wide profiler for Linux systems, capable of profiling all running code at low overhead. It consists of a kernel driver and a daemon for collecting sample data, and several post-profiling tools for turning data into information. Note that unlike gprof, no instrumentation (-pg and -a options to gcc) is necessary. Latest version OProfile 0.9.3 (2007-07-16 released) System requirements Linux kernel 2.2/2.4/2.6 2.2/2.4: power management will cause system crash
Features (1/3) Unobtrusive System-wide profiling 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. System-wide profiling All code running on the system is profiled, enabling analysis of system performance. Performance counter support Enables collection of various low-level data, and association with particular sections of code.
Features (2/3) Call-graph support Low overhead Post-profile analysis With an x86 or ARM 2.6 kernel, OProfile can provide gprof-style call-graph profiling data. Low overhead OProfile has a typical overhead of 1-8%, dependent on sampling frequency and workload. Post-profile analysis 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.
Features (3/3) System support 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.
Commands #ophelp #opcontrol #opreport #opannotate This utility lists the available events and short descriptions. #opcontrol Used for controlling the OProfile data collection #opreport This is the main tool for retrieving useful profile data #opannotate This utility can be used to produce annotated source, assembly or mixed source/assembly. Source level annotation is available only if the application was compiled with debugging symbols.
Reference OProfile OProfile manual OProfile internals http://oprofile.sourceforge.net/news/ OProfile manual http://oprofile.sourceforge.net/doc/index.html OProfile internals http://oprofile.sourceforge.net/doc/internals/index.html
Demo