home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
c
/
prf.arc
/
README
< prev
Wrap
Text File
|
1988-11-24
|
2KB
|
69 lines
This is a small package to help you decide where a
small or compact model program running under MSDOS is
spending its time..
It is limited. It does not take into account time spent
in system calls from a routine, it can only handle a single
code segment. That said it can probably help you direct your
efforts to those computationally intensive parts of your program
that need to be tightened up.
To use the package a TSR routine (prf.exe) needs to be installed.
i.e. at the MSDOS prompt (or in autoexec.bat) type "PRF" (no quotes).
Within your program you will need to call two routines. These should
be invoked before and after the bits you want to profile.
Here is a sample program.
------------------------------
#include <stdio.h>
#include "prfifl.h"
#include <dos.h>
long TT()
{
int i; long j;
for(i = 0 ; i < 16 ; i++)j += i ; return j;
}
main(argc, argv)
int argc;
char **argv;
{
long l, ac = 0;
/* START PROFILING */
PRFstart((long far *)main);
for (l=0;l<100000L;l++) ac += l*l + TT();
/* STOP PROFILING */
PRFstop();
}
------------------------------
the program should be linked to include the files
PRFIFL.OBJ and PRFUTIL.OBJ
and you will need the .MAP file, so specify /MA as an option.
e.g a link command line of the form
link myprog+prfifl+prfutil,,,/MAP/LI
These include 'C' routines and so will need 'C' support
for the creation of the profile data file (fixed at PROFIL.OUT).
After running the program you will find the file PROFIL.OUT has
appeared and contains a list of the number of times that the clock
interrupt found that it had interrupted your program at each ip value.
( strictly speaking within the 8 byte block following the printed IP)
To get a slightly more user friendly report run the program PRFPRINT
with the name of the program .MAP file as its argument. This will
give the percentage time spent in each of the routines. There may be
some inaccuraccies because of the eight byte block spanning the boundary
between two routines, in which case all the time will be allocated to the
routine occurring lower in memory. This is a statistical test and so
programs running for a short period of time will not be accurately profiled.
The moral of this is to let the thing repeat several times over a period
of many seconds (minutes?)