Correlating GHC Cost-Center Profiles with ThreadScope Eventlogs for Unified Bottleneck Analysis
0 reputation · 22 Mar 2022, 07:19 UTC
0 reputation · 22 Mar 2022, 07:19 UTC
GHC provides two complementary profiling mechanisms: cost-center profiling (-prof -fprof-auto) for source-level attribution of time and allocation, and the runtime eventlog (-eventlog) for ThreadScope visualization of thread scheduling, garbage collection, and spark behavior. Both can be enabled simultaneously during compilation, yet they emit independent data streams with no shared correlation identifiers.
Cost-center profiling introduces 2–10× overhead and can distort lazy evaluation, while eventlog files grow to hundreds of megabytes for long runs. The GHC community has discussed extending the eventlog format to embed cost-center identifiers, but proposals face backward-compatibility and eventlog-size concerns. No stable toolchain natively merges the .prof report with the .eventlog timeline; developers manually align hotspots across separate runs, risking misattribution when lazy forcing sites differ from definition sites.
Assuming GHC 9.6+ with -threaded and multiple capabilities (+RTS -N), what is the current feasibility of a single-run workflow that binds cost-center entries to eventlog timestamps?
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.