|
|
The steps for compiling a program for flow profiling are basically the same as those described for prof.
Whether you are using flow profile logs for performance analysis or for locality tuning, the procedure is the same. However, when compiling for locality tuning, it is strongly recommended that every source file that is part of the object to be tuned be compiled for flow profiling. This is not necessary if the data is to be used for performance analysis.
You must compile your source files
with the -qf option to create flow profile logs.
Using the same example described previously:
$ cc -qf -o travel travel.c misc.c
As noted earlier, if you compile and link your program in separate steps, you must specify -qf when you link as well as when you compile:
$ cc -qf -c travel.c $ cc -qf -c misc.c $ cc -qf -o travel travel.o misc.o
Alternatively, if recompiling your program is not convenient, you can use fur to insert profiling code into your objects.
$ fur -p all -e all travel.o $ fur -p all -e all misc.o $ cc -qf -o travel travel.o misc.oYou can gather data for parts of a program by only compiling the relevant source with the -qf option. However, when compiling for locality tuning, it is strongly recommended that every source file that is part of the object be compiled for flow profiling; otherwise, the accuracy of the analysis is compromised.
$ cc -qf -c travel.c $ cc -c misc.c $ cc -qf -o travel travel.o misc.oIn this case, no information will be produced in the log for functions defined in misc.c.
For shared objects, the steps are quite similar:
$ cc -qf -c travel.c $ cc -c misc.c $ cc -G -o libtravel.so -qf travel.o misc.o
For this example, any program that is compiled with libtravel.so will automatically log events whenever code in travel.c is used.