Master the fundamental concepts of profiling & measurement through this focused micro-challenge.
Flame graphs turn thousands of perf record stack samples into one SVG where width equals sample count. Brendan Gregg invented them to answer which functions dominate CPU time across whole call chains, not just flat self time. Kernel developers, database teams, and game studios use the same workflow when a service is hot but the culprit function is buried five frames deep.
Record at high frequency, collapse stacks, feed them to flamegraph.pl. The y-axis is stack depth; the x-axis is proportion of samples. Wide plateaus are where you optimize first.
bashLoading…
-g so call chains appear, not just leaf symbolsKeep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will write a program with deliberate hotspots and generate a flame graph from perf record output. This exercise requires you to identify the widest frame and tie it back to a specific loop in your source.
Implement a program with measurable hotspots and generate flame graph.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github