I’ve used ghc-prof-flamegraph https://hackage.haskell.org/package/ghc-prof-flamegraph for timing information.

On Nov 25, 2021, at 4:28 PM, Johannes Waldmann <johannes.waldmann@htwk-leipzig.de> wrote:

Dear Cafe,

with +RTS -p -RTS, the resulting .prof file
shows (in the second part) what the expensive functions are.
(counting sections as GHC docs do -
first part gives program name and options)

Often, that's useful, but sometimes, this info does not surprise me -
some things just don't have an easy implementation.
For those, I want to find out who calls them -
to possibly replace some of these calls
with a cheaper implementation (that is only valid
because the caller knows something that the callee does not)

Is there some automation for getting this information?
I am not even sure how to formalize what I want.
Perhaps, for the first N heavy cost centers (SCCs),
a suitably ordered list of their callers (that inherit the cost)?

The data is in the third (long, detailed) part of the .prof file
but I find it hard to process (in that form). It represents
the call hiearchy by indentation (first column) and adjacency (of rows)
but this goes out the window as soon as I grep or sort the rows.

The JSON output format seems the way to go
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html#json-profile-format
.
Yeah, I should probably just aeson it and then walk the tree.
I still wanted to ask for advice first, or references
to existing work. Any pointers appreciated.

- J.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.