The fdpr (feedback-directed program restructuring) program optimizes executable modules for faster execution and more efficient use of real memory. To determine whether the fdpr program is installed and available on your system, run the following command:
# lslpp -lI perfagent.tools
The fdpr command is a performance-tuning utility that can improve both performance and real memory utilization of user-level application programs. The source code is not necessary as input to the fdpr program. However, stripped executable programs are not supported. If source code is available, programs built with the -qfdpr compiler flag contain information to assist the fdpr program in producing reordered programs with guaranteed functionality. If the -qfdpr flag is used, it should be used for all object modules in a program. Static linking will not enhance performance if the -qfdpr flag is used.
The fdpr tool reorders the instructions in an executable program to improve instruction cache, Translation Lookaside Buffer (TLB), and real memory utilization by doing the following:
For example, given an "if-then-else" statement, the fdpr program might conclude that the program uses the else branch more often than the if branch. It will then reverse the condition and the two branches as shown in the following figure.
Figure 6-1. Example of Conditional Branch Recoding. The illustration shows how conditional branch recoding changes certain code. For example, the code If (condition) would become If (! condition); the code then stays then; instructions becomes other instructions; else stays else; other instructions become instruction; and endif stays endif.
Large applications (larger than 5 MB) that are CPU-bound can improve execution time up to 23 percent, but typically the performance is improved between 5 and 20 percent. The reduction of real memory requirements for text pages for this type of program can reach 70 percent. The average is between 20 and 50 percent. The numbers depend on the application's behavior and the optimization options issued when using the fdpr program.
The fdpr processing takes place in three stages:
As an example, the command:
# fdpr -p ProgramName -R3 -x test.sh
would use the testcase test.sh to run an instrumented form of program ProgramName. The output of that run would be used to perform the most aggressive optimization (-R3) of the program to form a new module called, by default, ProgramName.fdpr. The degree to which the optimized executable program performed better in production than its unoptimized predecessor would depend largely on the degree to which the testcase test.sh successfully imitated the production workload.
Note: The fdpr program incorporates advanced optimization algorithms that sometimes result in optimized executable programs that do not function in the same way as the original executable module. It is absolutely essential that any optimized executable program be thoroughly tested before being used in any production situation; that is, before its output is trusted.
In summary, users of the fdpr program should adhere to the following: