Files
cleanyourtv/tools/flamechart.md
T
simandClaude Opus 5.5 6e2ec10231 docs/workflows/perf-ab.md: measure a launcher change with traces and a flame chart
The first workflow doc in the shape agreed in #563: a one-line "When to use this", a checklist, and
links to the tool guides rather than a copy of them. It writes down the method #666 used: choose the
scenario and the slices before measuring, trace both builds 5 times, report, draw the flame charts
with that highlight, check behaviour, and what goes in the PR.

AGENTS.md's repo map lists docs/workflows/, and tools/trace.md and tools/flamechart.md link to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 22:56:39 +10:00

2.0 KiB

tools/flamechart.py

Draw a before/after flame chart PNG from tools/trace.py traces: one lane per thread, both panels on one time scale, the work your change targets in magenta with its total. Use it to show where a difference from tools/trace_report.py comes from; attach the report's table next to it.

tools/venv/bin/pip install -r tools/requirements-perf.txt     # adds Pillow
tools/venv/bin/python tools/flamechart.py traces/before traces/after \
    --highlight '^(activityResume|RV OnBindView)$' \
    --title 'Back to Home: Home press to first frame' \
    --subtitle 'TCL C755, Google TV 14 · magenta: onResume and tile binding' \
    --out chart.png
Option Default Notes
TRACE ... Before, then after (up to 4). A folder draws its median run (by time to first frame, or median frame time for nav), named in the panel.
--highlight REGEX ^(activityResume|RV OnBindView)$ Slice names to draw magenta and total. Children of a match count once.
--window first-frame first-frame: launcher start to first frame drawn. start:MS: a fixed span from the start. all: the whole recording (always for nav).
--threads main,RenderThread Lanes, by thread name in the launcher's process.

A Home change usually needs two charts:

  • The start: the defaults, with --highlight set to the slices you removed.
  • The frames after it: --window start:1500 --threads RenderThread --highlight '^DrawFrame'.

Rules

  • Choose --highlight before you look. Name the slices your change should remove, then draw. A regex fitted to whatever shrank proves nothing.
  • Pass folders, not single runs. The tool picks the median run. If you pass single traces, say why.
  • Magenta is main and render thread time only. Work moved to another thread or to the GPU isn't gone: add that thread as a lane, or use the nav GPU numbers.

The whole before/after method for a pull request is in docs/workflows/perf-ab.md.