profiling,-O in 6.12.1

Daniel Fischer daniel.is.fischer at web.de
Wed Feb 3 11:38:36 EST 2010


Am Mittwoch 03 Februar 2010 16:44:31 schrieb Serge D. Mechveliani:
> Dear GHC team,
>
> It looks like  ghc-6.12.1  reports erroneous time profiling --
> when the Main module of the project is made under  -O.
>
> This is for  ghc-6.12.1  made from source for Debian Linux and
> i386-like.
>
> Main.main  calls for  Complete.complete,  `complete' calls for
> eLoop  inside its source.
> eLoop  must take almost all the time.
> My whole user library is made under  -O -prof,  and
>                                      --enable-library-profiling.
> Main  is compiled by
>                          ghc $dmCpOpt -prof --make Main
> and run by               ./Main +RTS -M400m -pT -RTS
> For this key, the profiling report Main.prof looks natural and shows
>                                                    eLoop -- 97%.
>
> But for        ghc $dmCpOpt  -O  -prof --make Make,
>
> it shows a different thing:  zero  for  eLoop  and  99%  for `main'.

Could be that eLoop is inlined with -O.

Try

ghc $dmCpOpt -O -prof -auto-all --make

That should show eLoop (if that's a top-level declaration, otherwise you'd 
have to insert a pragma {-# SCC "eLoop" #-} manually).

>
> How could this additional  -O  mislead the compiler?
> Also, as I recall,  -O  is still by default -- ?

No, default is "comile as fast as possible", no optimisations (-O0).

>
> Could you explain, please?
>
> Regards,
>
> -----------------
> Serge Mechveliani
> mechvel at botik.ru


More information about the Glasgow-haskell-users mailing list