[Haskell] reading call graphs
Simon Marlow
simonmar at microsoft.com
Tue Sep 13 08:29:10 EDT 2005
On 24 August 2005 11:10, Malcolm Wallace wrote:
> "Scherrer, Chad" <Chad.Scherrer at pnl.gov> writes:
>
>> individual inherited
>> COST CENTRE MODULE no. entries %time %alloc %time %alloc
>>
>>
>> MAIN MAIN 1 0 0.0 0.0 100.0 100.0
>> main Main 228 92329 0.2 0.9 99.8 99.8
>> step Main 259 679 38.4 26.6 56.6 39.2
>>
>> I'm trying to understand the "entries" column. I thought this was the
>> number of times a given function is called. But "main" is
>> nonrecursive, and only calls "step" (also nonrecursive) once. Where
>> are the 92329 and 679 coming from?
>
> Perhaps these functions are split into smaller chunks by the
> compiler/optimiser? Then the profiler would aggregate the data for
> the individual chunks back up into the original cost centre.
That's a plausible hypothesis. Each time an expression of the form ({-#
SCC "foo" #-} e) is evaluated, the entries count for "foo" is
incremented. The effect of -auto-all is to wrap each top-level function
in an {-# SCC #-} expression, so you would normally get one entry per
call of the function. However, the optimiser can change the structure
of the code. Optimisations are supposed to retain the cost attribution
model, but they don't necessarily retain the same entry counts.
Basically I find the entries figure is a useful sanity check (i.e. "is
this function called at all?"), but not much more than that.
Cheers,
Simon
More information about the Haskell
mailing list