MAN page from RedHat Other bprof-2.0beta-1.i386.rpm
BPROF
Section: Version 2.0 (1)
Updated: 16 April 1997
Index NAME
bprof - profile per source line
SYNOPSIS
bprof [
options] [
executable [
bmon.out ... ] ]
DESCRIPTION
bprof makes an execution profile per source line of yourprogram. In other words, it gives you the time spent in each line ofyour program. This allows you to know precisely on what part of theprogram to spend your efforts at speeding it up.
To get such a profile, compile your program with -g and link it withthe object file bmon.o. Make sure that the bmon.o file islinked immediately after your .o files, before any system libraries.Example:
gcc -g -c foo.cgcc -g -c bar.cgcc -o fubar foo.o bar.o /usr/lib/bmon.o -lm
You can specify optimization flags. This will give you a betterestimate of the program behaviour when it is optimized, but it canmake the data hard to interpret as the relation between source andobject code can be obscure.
Running the program should produce a file bmon.out in thecurrent directory (that is the current directory of the program at themoment it exits). Now run bprof on your executable. Thisshould produce files foo.c.bprof and bar.c.bprof which arethe same as the corresponding source files, but have the time spent ineach line prepended to that line. A '.' in the outputindicates a line where no measurable time was spent.
Time spent is measured in clock ticks, so in 1/100 of a second. Astiming statistics are taken stochastically by recording the currentinstruction at each clock tick, these numbers are not exact and canvary from one run to another. Note that a source file that does notget any clock tick will not have a .bprof file created.
A note for C++ users: Initialization and cleanup of timing is done inthe constructor and destructor of a static C++ object. Because C++does not define the order of execution of constructors and destructorsof static objects in different compilation units, time spent in thosemay or may not be taken into account.
The first non-option argument given will be taken as the name of theexecutable (default: a.out). Any further arguments are interpreted asthe names of bmon.out files (default: bmon.out). If you specify moresuch files bprof takes the sum of the timings of these files.
OPTIONS
- -d directory
- Also use any source files in directory to make profiles. Youcan use multiple -d flags for multiple directories. Thecurrent directory is always used.
Note that in any case source files will only be looked for by the fullpath name they had at the moment of compilation. If you have movedthem around since compilation, you need to recompile, move them backor create a symlink somewhere.
- -s suffix
- Use suffix instead of .bprof to add to the source filenames to get the output file names.
- -v
- Verbose mode. Print the names of all the source files used.
ENVIRONMENT
- BPROFDIR
- If this variable is set, the program will write the bmon.out file inthat directory instead of the current directory of the program when itexits.
FILES
- bmon.out
- contains timing data
- /usr/lib/bmon.o
- object file to link with your programs to get timing data
SEE ALSO
gprof(1)
BUGS
Profiling will not be done while your program is blocking the VTALRMsignal. If you use the VTALARM signal yourself, however,
bprofwill not work anyway.
AUTHOR
Bas de Bakker. The latest version of
bprof should be availableat sunsite.unc.edu in the directory /pub/Linux/devel.
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- OPTIONS
- ENVIRONMENT
- FILES
- SEE ALSO
- BUGS
- AUTHOR
This document was created byman2html,using the manual pages.