profiling,-O in 6.12.1
Simon Marlow
marlowsd at gmail.com
Thu Feb 4 04:50:14 EST 2010
On 03/02/2010 17:59, Serge D. Mechveliani wrote:
> To my
>
>>> 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'.
>>
>
>
> On Wed, Feb 03, 2010 at 05:38:36PM +0100, Daniel Fischer wrote:
>
>> Could be that eLoop is inlined with -O.
>
> Thank you.
> I also thought about this. But the question still looks difficult.
>
>
>> 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).
>>
>
> eLoop is not a top-level declaration, and I do set {-# SCC "eLoop" #-}.
> The key combination
> ghc $dmCpOpt -prof --make Main
> shows 95% for eLoop,
> and adding -O to this line shows 0% for eLoop, independently on
> presence of -auto-all in this line
> (the whole library is made under -O -prof).
There are known bugs in this area, see e.g.
http://hackage.haskell.org/trac/ghc/ticket/2552
> Yes, I recall that the effect may be of inlining.
Inlining should not in general affect the shape of the profile. I can't
say much else here without seeing the specific code.
Cheers,
Simon
More information about the Glasgow-haskell-users
mailing list