Linux performance series: low-overhead statistical profiling with oprofile

18

Author: Flavio Villanustre

Sometimes system administrators need to determine where applications spend most of their time, in order to tune their systems better. The traditional method, when the source code for the application and gcc are available, is just to recompile the application with the -pg flag and to use gprof to profile it. Other than the inconvenience of the recompilation process, the solution is pretty straightforward. But what happens when you don’t have the source code for the application? And what if you’d like to profile the system as a whole?That’s when oprofile becomes handy. Oprofile is an unobtrusive low-overhead system-wide profiler for Linux. Oprofile doesn’t require to recompile your applications or to use wrapper libraries, and all running code can be profiled at the same time, enabling analysis of system performance. Oprofile has a low overhead, thus having a minimal impact on the results.