Lightweight profiling with ghc-stack-profiler
summary
Lightweight sampling profiler implemented as a Haskell library that writes samples to the eventlog by periodically cloning RTS call stacks with the existing cloneThreadStack primitive and serialising frames. It doesn’t need the profiled RTS or recompilation of dependencies, but it requires -finfo-table-map for source locations and benefits from GHC 9.14 stack annotations to label regions. Output converts to SpeedScope via gstack-profiler-speedscope. Sampling is configurable (µs–ms); reported overheads in real workloads are around 20% and pure/lazy code can hide annotations.
AI-written summary · about
chapters (6)
- 0:00Introduction to the profiler
- 1:36Architecture and design
- 4:59Practical demonstration
- 14:25Stack annotations explained
- 20:49Strategic usage guidelines
- 22:40Summary and Q&A
related talks
01h 24mWhat we have learned about memory profiling in the last 5 years
41mPinpointing memory leaks in production Haskell deployments
26mghc-specter: a GHC plugin that inspects the GHC state on live
01h 30mGHC's Runtime System
01h 02mOptimising for fast builds with GHC
38mLightning talks
56mDeterministic Parallel Programming with Haskell
01h 26mReflections on Haskell@Meta
