[comp.lang.misc] Profilers

sommar@enea.se (Erland Sommarskog) (02/25/90)

Piercarlo Grandi (pcg@rupert.cs.aber.ac.uk) writes:
>Very few. Actally, in most cases, profiling requires recompilation,
>and this is often not very attractive, and in any case very few
>programmers would understand the profile.
>...
>3) ways to make it easier to profile for time, e.g. for a coarse first
>   run use statistical PC sampling, without recompilation, and then
>   using flow graph based tecniques;
>
>4) ways to make it possible to profile for space, e.g. for a coarse first
>   run use statistical page reference sampling, without recompilation, then
>   using flow graph based techniques, e.g. in malloc() or equivalents;

Seems you're looking for PCA, Performance and Coverage Analyzer, a
layered DEC product for VMS which does most of that and more.

PCA uses the same information as the debugger, so although that you
explicitly can link to PCA with /DEBUG=SYS$LIBRARY:PCA$COLLECTOR,
you can simply switch from the standard debugger to PCA by saying
DEFINE LIB$DEBUG SYS$LIBRARY:PCA$COLLECTOR and then with DEASSIGN
LIB$DEBUG to switch back. Recompile? Well, to get all symbol
information you have to compile with /DEBUG=ALL for which some
compilers /NOOPTIMIZE is recommended. However, for PCA /DEBUG=
TRACEBACK will include enough information to make PCA easy to use. 
And, fact is as long you don't link /NOTRACEBACK you can always run
PCA in some way.

Now, what you run with the program is the collector which simply
produces a data file. The other half of PCA is the analyzer which
gives you the possibility to look at what your program been doing.
You can see in which routines you spent the most time. You can
filter out irrelevant stuff like inititiation or routines where
you waited for user input. If you have a routine that you spend
a lot of time, you can see from which places that routine was
called and the frequency of the different calls.

And you are not restricted to PC sampling. You can sample system
calls, page faults and IO services. You and also collect which
lines that were executed at all. In short PCA is a very nice tool
to work with.

One thing it cannot. You cannot use PCA to get a feedback to the
compiler, at least as far as I know.

Now, I don't believe that VMS would be so much ahead of Unix,
although as a VMS fan that would be fun if that was the case.
You could surely find similar tools for Unix.
-- 
Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se