profiling in 6.2.2-pre

Serge D. Mechveliani mechvel at
Tue Aug 24 01:56:48 EDT 2004

Please, could you help me to arrange profiling with  cvs ghc-6-2-2

Without profiling, the  Makefile  contains

  HCFlags  =  $(language)  -i$(idirs) -odir $(e) -hidir $(e)  \
              -ddump-hi-diffs                                 \
              +RTS $(space) -RTS  $(extraHCOpts)

  extraHCOpts =

  pack = Package {name            = "\"dm\"",     \
                  import_dirs     = ["\"$(e)\""], \
                  source_dirs     = [],           \
                  library_dirs    = ["\"$(e)\""], \
                  hs_libraries    = ["\"HSdm\""], \
                  extra_libraries = [], \
                  include_dirs    = [], \
                  c_includes      = [], \
                  package_deps    = [\"data\"], \
                  extra_ghc_opts  = [$(extraPackageOpts)], \
                  extra_cc_opts   = [], \
                  extra_ld_opts   = [] }

        if [ ! -d $(e) ]; then mkdir $(e); fi
        $(ghc) $(HCFlags) --make DExport  -package-name dm

  dm: obj
        rm -f  $(e)/libHSdm.a $(e)/HSdm.o
        ar -qc $(e)/libHSdm.a $(wildcard $(e)/*.o)
        $(RANLIB)  $(e)/libHSdm.a
        $(RANLIB)  $(e)/libHSdm.a
        echo $(pack) | $(ghcpkg) -f $(s)/dm.conf -u -g
        $(ghcpkg) -f $(s)/dm.conf -l 

First, I do not recall why the line   $(RANLIB) $(e)/libHSdm.a
repeats, by intention or by a typo.

Then, for the profiling, I set

  extraHCOpts = -prof -hisuf p_hi -osuf p_o
  dm: obj
        rm -f  $(e)/libHSdm* $(e)/HSdm*
        ar -qc $(e)/libHSdm_p.a $(wildcard $(e)/*.p_o)
                           ~~~~                   ~~~~
        $(RANLIB)  $(e)/libHSdm_p.a
        $(RANLIB)  $(e)/libHSdm_p.a
        echo $(pack) | $(ghcpkg) -f $(s)/dm.conf -u -g
        $(ghcpkg) -f $(s)/dm.conf -l 

To build the test, I command

  cd demotest
  ghc  $pcpdm  -prof -hisuf p_hi -osuf p_o  --make Main 

Please, where to set    foo_p.a  or  foo.p_a  ... ?
(or what it might be).
And how the above   $(ghcpkg) ... -u -g   correlates with this.
What to change in   
                    pack = Package {... ? }

I set it one way, and the library build reports

   cannot find `libHSdm.a' on library path.

I set it other way, and 

         ghc  $pcpdm  -prof -hisuf p_hi -osuf p_o  --make Main 

reports    cannot find  HSdm_p
Should it be  
   export/HSdm_p.o     or   HSdm.p_o     or  HSdm.o      or ?
   export/libHSdm_p.a  or   libHSdm.p_a  or  libHSdm.a   or ?
As Simon Marlow has the source,  maybe he could send me the 
corresponding settled Makefile?

> In the future, Cabal will make this easier. 
> Have you tried using Cabal for docon yet?  
> It should simplify a lot of things for you.
I applied profiling with GHC 2-3 years ago. It helped.
And do not recall of  Cabal,  nor even of  -hisuf p_hi -osuf p_o 
Why should GHC complicate the usage?
Thank you in advance for the help,

Serge Mechveliani
mechvel at

More information about the Glasgow-haskell-users mailing list