DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
C programmer's productivity tools

Cautionary notes on using lprof

This section describes solutions for several problems that may arise while you are using lprof.

Trouble at compile time

Sometimes if you are compiling with one or more forms of optimization together with the profiling option, you will get an error warning that there is an incompatibility between obtaining profiling information and optimization. This is usually a permissible combination of options, but occasionally the compiler does not accept it.

You may not need to have the function in question profiled. If not, ignore this warning; data will be collected in the data file for all other functions. If you do want data for the function in question, compile your program again with the profiling option but without optimization. The warning should not reappear.

Non-terminating programs

If the profiled program does not terminate normally, no profiling data will be saved. The profiling data is saved at termination by the system call exit(S). If exit is never called, no profiling data is saved.

Failure of data to merge

If a program has been recompiled, a new data file will be created in a temporary directory. The path name of the new file will be printed to stderr.

Trouble at the end of execution

At the end of execution, you may see the following error message:

   dumping profiling data from process 'a.out' . . .
   ***unable to seek to symbol table
Usually this is caused by running a stripped version of a profiled program. Never strip files to be profiled. If necessary, change ``makefiles'' so that they do not produce stripped files.

No data collected

Sometimes you may get no data after running a profiled program. The program terminates normally, and you receive neither a message about data being saved, nor an error message. This may be caused by one of two problems:

Data file not found

Occasionally, lprof may not be able to find the data file, despite the fact that the profiled program has terminated normally and you have received a message saying that the data file has been created.

The profiled program creates the data file in the directory in which the program is located when it terminates. If the program changes directories, the data file may be created in a directory different from both the one from which you executed the program and the one in which the shell is located when the program terminates.

Use the dir option of PROFOPTS to specify exactly where the data file is to be created, so you will be able to find it.

Using lprof with program generators

Program-generators such as lex and yacc make use of the #line preprocessor directive to change line numbering. This generally disrupts line profiling such as is done with lprof.

Using lprof with shared libraries

It is recommended that when profiling with lprof, you use archived versions of libraries rather than shared versions.


Next topic: Improving performance with prof and lprof
Previous topic: Merging option

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003