Skip to main content

Module svg

Module svg 

Source
Expand description

A standalone flame graph.

The file is self contained: one document carrying its own styling and the small amount of script that makes it explorable, so it can be attached to a report, committed beside a release, or opened straight from disk. It degrades to a readable picture with scripting turned off, because every frame carries a native title.

The shape follows the flame graph convention, which readers already know: width is how much reaches through a frame, depth is call depth, clicking a frame zooms into it, and ctrl-F searches. Zooming keeps the path to the frame in view as full width bars and hides what the frame does not contain, so the picture stays a picture of one path. Searching colours what matched and says how much of the whole it accounts for.

The picture is as wide as the window it is opened in. Frames are placed as shares of the width rather than at pixels, so they stretch with the window while the text keeps its size, and the script fits every label again whenever the width changes. What is written into the file is fitted for the width flame graph tools draw at, which is the picture a viewer without scripting shows, scaled as a whole to fit.

The colours are the interactive view’s, read from the palette file both share: three hue families say what kind of panic a frame is, each category takes a step of its own on its family’s hue, and a call is tinted by the family most of the panics under it belong to. Siblings of equal width are banded by family, so the many narrow frames read as runs of one colour rather than confetti.

The project’s mark sits in the corner, at the height of a control, so it says what drew the file without competing with the title. It links to the project and names the version, so a file handed on alone still says where it came from.

Structs§

View
What the picture shows, and how.

Functions§

render
Renders the flame graph as a standalone document.