Kenwood HP 9000 Personal Computer User Manual


 
280 Chapter 8
Ways to Improve Performance
Profile-Based Optimization
user's environment. Then, the optimizer will focus its efforts on the parts
of the program that are critical to performance in the user's
environment. You should not have to do a large number of profiling runs
before the optimization phase. Usually it is adequate to select a small
number of representative input data sets.
The flow.data File
When an instrumented program terminates with the exit(2) system call,
special code in the 32-bit icrt0.o startup file or the 64-bit
/usr/ccs/lib/pa20_64/fdp_init.o file writes profile data to a file
called flow.data in the current working directory. This file contains
binary data, which cannot be viewed or updated with a text editor. The
flow.data file is not updated when a process terminates without calling
exit. That happens, for example, when a process aborts due to an
unexpected signal, or when program calls exec(2) to replace itself with
another program.
There are also certain non-terminating processes (such as servers,
daemons, and operating systems) which never call exit. For these
processes, you must programmatically write the profile data to the
flow.data file. In order to do so, a process must call a routine called
_write_counters(). This routine is defined in the icrt0.o file. A
stub routine with the same name is present in the crt0.o file so that the
source does not have to change when instrumentation is not being done.
If flow.data does not exist, the program creates it; if flow.data
exists, the program updates the profile data.
As an example, suppose you have an instrumented program named
prog.inst, and two representative input data files named
input_file1 and input_file2. Then the following lines would create
a flow.data file:
$ prog.inst < input_file1
$ ls flow.data
flow.data
$ prog.inst < input_file2
The flow.data file includes profile data from both input files.
To save the profile data to a file other than flow.data in the current
working directory, use the FLOW_DATA environment variable as
described in “Specifying a Different flow.data with FLOW_DATA”.