Cprof is a performance profiler software designed for C/C++ programs used on GNU/Linux platforms, written in C language. It provides improved features to analyze the performance of the program.
One great feature of Cprof is that it supports both flat profiles and call graphs a'la gprof. Additionally, profiling multithreaded programs works out of the box, making it an all-around convenient tool to have in your toolkit.
To use Cprof, you'll need to meet a few software requirements. These include libelf >= v0.8.4, automake (tested with versions 1.4 and 1.6.3), autoconf (tested with versions 2.13 and 2.53), and libtoolize (tested with versions 1.4.2a and 1.4.2). Once you have these in place, you can begin profiling your program.
To get started, compile each object for profiling using the following command:
gcc -finstrument-functions -c slow_code.c
Then, link against libcprof:
gcc slow_code.o -o slow_code -lcprof
Once you've done this, run the program once to generate cmon.out in the current directory. Then, run cprofcompr without any arguments to compress cmon.out. You can then run cprof to get a text summary of the profiling results:
cprof slow_code
or
cprof slow_code > slow_code.prof
For more information on the command line syntax and useful arguments, simply run "cprof --help".
Some recent updates to the tool include a variety of changes to the build system, as well as tweaks to specific files like acinclude.m4, configure.in, ltmain.sh, and more. Additionally, updates were made to various .h and .C files to make better use of typename, std:: usage, != operator, and conditional compilators. One bug in tools/cprofcompr.C was also fixed.
Version 1.0.2: N/A