Download C for AIX User's Guide
Transcript
The program should now run faster than without PDF, if the sample used data was typical of actual program data. Note: When using -qpdf1, specify the search location for its libraries with the -L compiler option, as shown in step 2 above. Example 2 Here are the steps for a more elaborate example. 1. Set the PDFDIR environment variable: export PDFDIR=/home/user 2. Compile most of the files with -qpdf1. xlc -qpdf1 -O3 -c file1.c file2.c file3.c -L/usr/vac/lib 3. This file is not so important to optimize: xlc -c file4.c 4. Non-PDF object files like file4.o can be linked in: xlc -qpdf1 -lpdf file1.o file2.o file3.o file4.o -L/usr/vac/lib 5. Run several times with different input data: a.out < polar_orbit.data a.out < elliptical_orbit.data a.out < geosynchronous_orbit.data 6. You do not need to recompile the source of non-PDF object files: xlc -qpdf2 -O3 file1.c file2.c file3.c 7. Link all the object files into the final application: xlc file1.o file2.o file3.o file4.o “Compiler Options and Their Defaults” on page 218 “Options that Specify the Compiler Object Code Produced” on page 229 “L” on page 285 “l” on page 286 “O, optimize” on page 302 pg Option Type Default Value #pragma options -flag - - Syntax -pg Purpose Sets up the object files for profiling, but provides more information than is provided by the -p option. If the -qtbtable option is not set, the -pg option will generate full traceback tables. Example To compile myprogram.c for use with the AIX gprof command, enter: Appendix A. Compiler Options 311