flametrace

Build flamegraph charts for process trees, based on strace.

If you’ve ever wanted to know why a command is slow, flametrace can help! Run your command under flametrace and get a chart showing what else it ran inside itself.

Quickstart

Using flametrace is easy, just run any command under flametrace:

$ flametrace tox -e flake8
...
Ran "tox -e flake8" in 10.14s
strace: /tmp/tox-20210110_213825_852532.strace
folded: /tmp/tox-20210110_213825_852532.folded
chart:  /tmp/tox-20210110_213825_852532.svg

This will print an svg filename you can open to diagnose your process.

For example, here is flametrace’s output on its own lint process. Use “Right click > Open image in new tab” to interactively explore the chart.

_images/trace.svg

Interpretation

The chart produced by flametrace shows you how much process time was spent running each command, with its ancestors. Since commands might be spawned in parallel, some commands might appear in the chart to take more time than they really do. You can click into a child process to expand its children in the chart.

CLI

flametrace

Run a command and render a flamegraph based on its process tree.

flametrace [OPTIONS] [COMMAND]...

Options

--output-base <output>

output basename (OUTPUT.strace, OUTPUT.folded, OUTPUT.svg)

--flamegraph-options <flamegraph_options>

additional flamegraph options (e.g. –inverted)

--mode <mode>

what operations to trace (io is slower but more detailed)

Options

process | io

Arguments

COMMAND

Optional argument(s)