cprof :: main


Sourceforge project
SourceForge.net Logo

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.

What Can it Do?

Both flat profiles and call graphs a'la gprof are supported. Profiling multithreaded programs works out of the box.

What Can't it Do?

Profile shared libraries (although there is a profiler in the gnome CVS from Eazel which is a modified cprof that does.) Demangle C++ symbol names (run output through c++-filt for this.)


To Build and Use Tarballs

  • libelf: tested with v0.8.4, but should work with almost any. (Local tarball here). Caution, the configure script checks for the existence of this library but doesn't always fail the configure when it's not there. Working on this bug...

To Hack cprof

  • 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

Build Problems

The 1.0.2 release has been tried (both from CVS and the tarball) on Debian 3.0, Red Hat 7.3 and Red Hat 9.0 systems. Please report any problems so that a fix can be found.

The 1.0.1 release is just the last public release of cprof from Corel uploaded to sourceforge. It doesn't build nicely with more modern automake/autoconf versions, and does not include the configure script (ie. you must have automake/autoconf/libtoolize to build it.)


See cprof.html for a mini-HOWTO on building, installing, and using cprof.

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


	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.

Last Modified: $Date: 2003/09/25 21:04:20 $