Next Previous Contents

4. Quick Start

4.1 Quick Guide to Compiling vprof

tar xvfz vprof-0.12.tar.gz
cd vprof-0.12
./configure --prefix=/usr/local
make
su
make install

You will now have in /usr/local/lib libvmon.a, vmonauto.o, and vmonauto_gcc.o. In /usr/local/bin you will have the visual profiler, vprof, and a command line based profiler, cprof. If you do not have the Qt Toolkit installed in /usr/local/qt, vprof will not be produced, but cprof will provide all of its functionality. If you are not using GNU C, then you will not have vmonauto_gcc.o.

4.2 Quick Guide to Using vprof

With C language programs you must modify your program to call routines in vmon.o that start and stop profiling. C++ users can link in vmonauto.o that will automatically start profiling before main is called and stop profiling after exit is called.

If you would like to profile events other than cpu clock ticks, then set the VMON environmental variable to one of the PAPI events definitions. For example

setenv VMON PAPI_FLOPS
samples floating point instructions.

C Language Programs

Modify your program, prog.c:

main() {
  vmon_begin();
  ... your code here ...
  vmon_done();
}

Compile your program with the -g option, link in vmon.o, and run it:

gcc -g -O2 -o prog prog.c /usr/local/lib/vmon.o
./prog

This will produce a file vmon.out. Start the visual profiler:

vprof prog vmon.out

Or run the command line profiler:

cprof -e prog vmon.out

The -e option to cprof will print out everything.

C++ Language Programs

Compile your program with the -g option, link in vmonauto.o, and run it:

g++ -g -O2 -o prog prog.cc /usr/local/lib/vmonauto.o /usr/local/lib/libvmon.a
./prog

This will produce a file vmon.out. Start the visual profiler:

vprof prog vmon.out

Or run the command line profiler:

cprof -e prog vmon.out

The -e option to cprof will print out everything.


Next Previous Contents