Cprof is an enhanced performance profiler tool written in C for use with C/C programs under GNU/Linux. It was developed by Andrew Lewycky while a co-op at Corel Corporation. It was used mostly for performance profiling of Wine but is applicable to other programs.
Both flat profiles and call graphs a'la gprof are supported. Profiling multithreaded programs works out of the box.
· libelf >= v0.8.4
· automake: tested with versions 1.4 and 1.6.3
· autoconf: tested with versions 2.13 and 2.53
· libtoolize: tested with versions 1.4.2a and 1.4.2
To profile a program, compile each object for profiling:
gcc -finstrument-functions -c slow_code.c
Then link against libcprof:
gcc slow_code.o -o slow_code -lcprof
Run the program once, to generate cmon.out in the current directory. Run cprofcompr without any arguments to compress cmon.out. Run cprof as
cprof slow_code > slow_code.prof
to get a text summary of the profiling results.
cprof --help has more information on the command line syntax and useful arguments.
What's New in This Release:
· Updating with 1.0.2 changes that Andrew Lewycky kindly provided for the build system, other tweaks.
· acinclude.m4: paste the as.m4 file from later automake version (1.6) in so project can use it with older autotools.
· configure.in: moved AM_PROG_LIBTOOL check down as older autoconf didn't like it there (complained that AM_PROG_CPP was being called before AM_PROG_C). Added AM_PROG_AS.
· Changed checks for libelf.h and libelf/libelf.h.
· ltmain.sh: new version from running libtoolize; seems to have
· fixed build problems
· cprof/profiledata.h: Updated typename and std:: usage.
· cprof/funcdata.h: Added != operator.
· cprof/symbols.h: Use conditional compilator for our libelf.h includes.
· lib/profile.c (CPROF_SAVE_PROFILE_ON_EXIT): Use environmental variable to control access to previously inactive profile_save("cmon.out") call on exit.
· tools/cprofcompr.C: #include to get definition of std::bad_alloc. Fix bug that made compressed cmon.out files useless when the total number of valid_arcs was < 512.
· tools/cprofinfo.C: #include to get definition of std::bad_alloc
· unixerror.C: include throw() specification in unix_error::~unix_error() definition