Dec 192017
 
Link into Turbo C 2.0 programs and will generate a log file of all function calls, including % of time spent in each. Can also generate a histogram from the data. Appears to work with Turbo C++ also.
File PROFIL.ZIP from The Programmer’s Corner in
Category C Source Code
Link into Turbo C 2.0 programs and will generate a log file of all function calls, including % of time spent in each. Can also generate a histogram from the data. Appears to work with Turbo C++ also.
File Name File Size Zip Size Zip Type
PROF.OUT 32 17 deflated
PROFILE.C 19531 4457 deflated
PROFILE.OBJ 6831 4076 deflated
PROFPRT.C 3188 1046 deflated
PROFPRT.EXE 26176 17825 deflated
PROFPRT.OBJ 1442 1056 deflated
README 3056 1447 deflated
TEST.C 1164 396 deflated
TEST.EXE 22168 12169 deflated
TEST.OBJ 1181 666 deflated
TEST.PRJ 4558 1275 deflated

Download File PROFIL.ZIP Here

Contents of the README file


This profiler is exclusively written in Turbo C. It only requires a
single line to be placed in main() to profile all non-static functions
in a PROGRAM :

prof_start(argv);

PROGRAM must be compiled with either the Public or Detailed linker map option.

Executing PROGRAM creates a text file : prof.out

Entering the command : profprt

Outputs (stdout) the report. The -h flag of profprt outputs a simple
histogram.


Dan Zemke
Compuserve 73230,1543



*** Original README file for Microsoft C version follows ***

Included here is the source for an execution profiling system that can
be used with the Microsoft C or the Microsoft Quick C compiler. It
gives the time percentage a program spends in different functions. It
is an indispensable tool when trying to optimise a program. The system
has been tested with Microsoft C Version 5.00.

In order to use the profiler first create the object files sprof.obj,
lprof.obj, mprof.obj and cprof.obj by typing ``make''. The makefile
supplied expects a Un*x compatible linker, so if you are using the one
that came with the compiler do the compilations by hand.

Compile your program in such a way as to create a linker map file. To
do this link your program with the -Fm option of cl or the /MAP option
of the linker. The appropriate [slmc]prof.obj module has to be linked
together with the rest of the program. The first letter of the module
indicates the memory model in use. The program should call the
function prof_start( argv[0] ) for versions of MS-DOS above or equal to
3.00 or prof_start( .map file name ) for MS-DOS versions before 3.00 in
order to start profiling. When the program finishes the profiler
automatically produces a prof.out file that contains the names of all
public symbols and the number of hits for each one.

You can read the results directly from the prof.out file, or you can
summarize them using profprt. Profprt reads the prof.out file (or
another file if specified) and produces a list of hits and percentages
for the functions for which hits were recorded. If given a -h option it
also produces a histogram of the relative timings.

A small test program is included to check the profiler functioning. It
generally found the profiler results to be within 1% of the expected
results on an 8MHz PC.

The profiler is all written in C utilizing the ability to create
interrupt handlers in C. It finds the addresses of the functions from
the linker map file. It should not be very hard to modify the source
for other compilers. Keep in mind that functions declared as static
are not included in the map file, thus will not be profiled and plan
accordingly. One solution is to compile with -Dstatic= if the naming
scheme used allows it. Pay attention to quantization errors and to
errors due to incorrectly specified boundaries. Portions of the code
that are executed with interrupts disabled will not be profiled.

Diomidis D. Spinellis ([email protected])
Myrsinis 1
GR-145 62 Kifisia
GREECE


 December 19, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)