A: Borland's separate
Turbo Profiler is a powerful tool for
improving program code and enhancing program performance,
but far
from an easy to use. It is an advanced tool. In fact setting it up
the first time is almost a kind of detective work.
Let's walk through the steps with Turbo Profiler version 1.01 to
see where a running Turbo Pascal program takes its time.
Assume a working directory r:\
1. Copy the target .PAS file to r:\
2. Compile it with TURBO.EXE using the following Compiler and
Debugger options. The standalone debugging option is crucial.
Code generation
[ ] Force far calls [X] Word align data
[ ] Overlays allowed [ ] 286 instructions
Runtime errors Syntax options
[ ] Range checking [X] Strict var-strings
[X] Stack checking [ ] Complete boolean eval
[ ] I/O checking [X] Extended syntax
[ ] Overflow checking [ ] Typed @ operator
[ ] Open parameters
Debugging
[X] Debug information Numeric processing
[X] Local symbols [ ] 8087/80287
[ ] Emulation
Debugging Display swapping
[X] Integrated ( ) None
[X] Standalone () Smart
( ) Always
3) Call TPROF.EXE
4) Load the .EXE file produced by compilation in item 2.
5) Choose from the TPROF menus
Statistics
Profiling options...
Profile mode
() Active ( ) Passive
Run count
1
Maximum areas
200
6) Choose from the TPROF menus
Options
Save options...
[X] Options
[ ] Layout
[ ] Macros
Save To
r:\tfconfig.tf
7) Press Alt-F10 for the Local Menu. Choose
Add areas
All routines
and so on.
8) Choose Run from the TPROF menus (or F9)
9) Choose from the TPROF menus
Print
Options...
Width
80
Height
9999
( ) Printer ( ) Graphics
() File () ASCII
Destination File
r:\report.lst
10) Print
Module...
All modules
Statistics
Overwrite
Also see Edward Mitchell (1993), Borland Pascal Developer's
Guide.
It has a a very instructive chapter "Program
Optimization" on the
Turbo Profiler. The material in the Turbo Profiler manual is so
complicated that additional guidance like Mitchell's is very much
needed.