Giving profiled object files a different extension (was: RE: Profiling suggestion)

Malcolm Wallace
Thu, 16 May 2002 14:17:04 +0100

"Simon Marlow" <> writes:

> > Re the current and recurring conflicts between profiling and
> > non-profiling code; how hard would it be to name GHC's output files
> > differently when compiling with -prof?
> The proposal, therefore, is to extend the meaning of '-prof' to mean
> '-prof -osuf p_o -hisuf p_hi' or similar.

It might be worth pointing out that nhc98 already does something like
this, and we find that it is definitely a big win.  We settled on .p.o
for heap profiling and .z.o for time profiling (also .T.o for tracing,
but that may disappear shortly with the advent of portable Hat).

> To summarise the advantages/disadvantages:
>   - win: you could store profiled and normal objects in the same
>     directory.

Very handy, because it means you can switch between normal and profiled
versions of a project without having to do a complete rebuild every time.

>   - win: you'd be less likely to mix up profiled and normal objects.

Mixing up object files was an absolute pain in the backside, and
happened far too frequently, until we adopted separate suffixes.

>   - lose: Makefile writing gets harder.  Extra suffix rules have to
>     be added to deal with the new suffixes, and 'make depend' has
>     to add dependency rules for the extra suffixes (ghc -M has some
>     support for doing this).  If you're using ghc --make this doesn't
>     affect you.

Worth noting also that `hmake' currently understands that -p (for
nhc98) means to look for the .p.o suffix etc.  It would be very
straightforward to extend the mechanism to do the same or similar
for ghc.