i960 Processor Compiler User's Guide
4-14
4
Profiling a Program in Pieces
Suppose that the target execution environment is memory limited so that
fee.o and foo.o cannot both be instrumented for profiling at the same
time. You can use substitutions to make partially instrumented versions of
prog, and then create self-contained profiles for each piece, as follows:
make SUBST=fprof MODULES=":fe*"
Execute prog to obtain raw profile default.pf.
gmpf960 -spf fe1.spf default.pf
make SUBST=fprof MODULES=":fo*"
Execute prog to obtain a new raw profile default.pf.
gmpf960 -spf fo1.spf default.pf
Note that neither of the invocations of the make tool causes compilations;
the make tool simply issues a link command in each case. Each link
command constructs a version of
prog that has a limited set of
instrumented modules:
ic960 -o prog -Ttarg -fdb -fprof
-gcdm,subst=:fe*+, iprof= fee.o foo.o
ic960 -o prog -Ttarg -fdb -fprof -gcdm,subst=:fo*+,
iprof= fee.o foo.o
Note also that although the example contains only two modules, the strings
that select the modules for partial program instrumentation use a general
regular expression mechanism. Such strings can select any possible subset
of the modules in a program for any substitution. This mechanism is
discussed in detail with the
gcdm,subst option in Chapter 6 of this
manual.
After creating the self-contained profiles
fe1.spf and fo1.spf, use
gmpf960 to create a single merged self-contained profile:
gmpf960 -spf prog.spf fe1.spf fo1.spf
The final prog.spf is identical to a profile obtained by instrumenting the
entire program at once. Now issue the
make command to get program-
wide optimizations guided by
prog.spf: