The protrans utility

Format: protrans options program

Options:
Protrans options
Option Meaning
-a
This switch adds the profile data for the current execution to the summary profile. Without this switch, a new profile is generated with each execution, overwriting the previous profile.
-q
This switch suppresses message printing. Without this switch, protrans prints a small message for each execution describing the type of profile data found.
-m file
Specifies file as a file containing calls profile data.
-g file
Specifies file as a file containing call graph profile data.
-b file
Specifies file as a file containing coverage analysis profile data.

protrans is a utility that reads profile data produced when a program built for profiling is executed. protrans accumulates profile data over multiple runs of a program. protrans translates the data into an intermediate format that the profiler uses when displaying profile data.

The protrans utility is also used outside of the MULTI environment. This is desirable if you want to automate the acquisition of large amounts of profile data, and then use the profiler to display the data once all the runs are complete. Suppose you have a program called dylan, built with some combination of calls, call graph, and coverage profiling (see "Standard calls", "Call graph", and "Block coverage"), and a sample input to the program: sampleinput1, sampleinput2, etc. Now, consider the following csh shell script:
#!/bin/csh
foreach p (sampleinput*)
$RUN dylan $p
protrans -a -q dylan
end
rm -f mon.out gmon.out bmon.out

This script repeatedly runs the dylan program with the sample input and calls the protrans utility to read in the generated profile data for each execution. The argument dylan specifies the profiled program from the generated data. The default is a.out.

After the script finishes, an intermediate profile data file is generated which contains the summary profile. The intermediate file has a .pro extension appended to the program name if there is no current extension. Otherwise, the .pro extension replaces the current extension. For example, the program fly.bat generates the file fly.pro. In the example above, the file dylan.pro is generated in the same directory we are executing.

Now you can process the data (see "Processing data") in the debugger to read in the summary profile stored in dylan.pro and then use the various features of the Profiler to view the information.

The last line in the script above deletes any profile data files left around after executions of the profiled program. The mon.out file is produced after running a program built for calls profiling. See "Standard calls" for more information. The gmon.out file is produced after running a program built for call graph profiling. See "Call graph" for more information. A program can only produce one or the other of these two files. A bmon.out file is produced after running a program built for coverage analysis (see "Block coverage"); this type of profiling is either done alone or in conjunction with either calls or call graph profiling. By default, the protrans utility looks for files with the names mentioned above. However, you can specify certain data files to protrans.

Thus, the shell script is rewritten:
#!/bin/csh
foreach p (sampleinput*)
$RUN dylan $p
mv gmon.out gmon.$p
mv bmon.out bmon.$p
end
foreach p (sampleinput*)
protrans -q -a -m mon.$p -b bmon.$p dylan
rm -f mon.$p bmon.$p
end

The first loop runs dylan with the sample input and stores the generated data files into uniquely named temporary files. The second loop then calls protrans to read in the data from these files and produces a summary profile. The -m switch specifies a calls profile data file; the -g switch specifies a call graph profile data file; the -b switch specifies a coverage analysis data file. You can specify multiple files of a single profile data type with multiple uses of these switches. For example:
protrans -m mon.1 -m mon.2 -m mon.3 ...

When using the profiler to run a profiled program to collect the resulting data, the actions of protrans are transparent to you. The information in this section is only provided for those who want to run protrans separately from MULTI.

Related topic:


Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.