Repo for storing profiling data
vendor/scope-profiler is a git submodule pinned to one commit. Everything
that draws a chart comes from it: scripts/generate_figures.py imports the
Python library to write the plot-data JSON, and docs/package.json resolves
@scope-profiler/plotly to vendor/scope-profiler/packages/plotly for the
browser code that renders it. Both halves are therefore always the same
commit -- before this, the Python side tracked the devel branch and the
browser side an npm release, so the two could drift apart between builds.
Clone with it:
git clone --recurse-submodules <this repo>
# or, in an existing clone
git submodule update --initMove it to a newer scope-profiler:
git -C vendor/scope-profiler fetch
git -C vendor/scope-profiler checkout <sha-or-branch>
git add vendor/scope-profiler # records the new commit
(cd docs && npm install) # refresh the lockfile if the JS changedThe docs publish workflow is in .github/workflows/publish-astro-docs.yml.
Docs are always built from the Astro project in docs/ and deployed to GitHub Pages from the Actions artifact (no commit/push back to the repository).
- CI uses Node.js 22 for docs dependency/install compatibility.
- Install dependencies:
npm ci(indocs/). This needs the submodule to be checked out, since the chart package is resolved from inside it. - Build docs:
npm run build --if-present(indocs/)
Figures are always generated from profiling data into docs/public/figures before the docs build.
The generation command is automated via:
python scripts/generate_figures.py
It scans every profiling case directory in the repository root — any folder holding a case_metadata.json next to .h5 runs, regardless of test case (diocotron, poisson, …) — and includes every .h5 file automatically.
Pass --pattern to restrict the run to a subset, e.g. --pattern '*-poisson_*'.
Case title and description fields in docs/public/figures/region_statistics.json are injected from each folder's case_metadata.json (with metadata.json accepted for backward compatibility).
Each profiling directory is processed independently, so plots are generated per-case under docs/public/figures/cases/<case-id>/ and are never merged across different folders.
Each run page shows a flame graph.
All run-level figures — durations, gantt, flame and the flame graph — are generated for rank 0 only for now.
scope_profiler.export_prof()writesprofile_rank0.prof.scope_profiler.export_flamegraph_svg()writesflamegraph_rank0.svg. It renders the same reconstructed call tree through flameprof (part of thepprocextra), and carries aviewBoxrather than flameprof's fixed 1200px width, so the page can scale it to the card.- The run page inlines the SVG rather than using it as an
<img>source, so the per-frame hover tooltips (percentage, call count, tottime/cumtime) work.
The .prof file is also published, and is downloadable from the run page for use with any pstats viewer.
Each run page also embeds speedscope, which shows every individual call rather than the aggregate the flame graph is built from — so it offers Time Order, Left Heavy and Sandwich views.
scope_profiler.export_speedscope()writesprofile.speedscope.json.- speedscope is a self-contained static web app with no server component.
docs/scripts/copy-speedscope.mjscopies its release build out ofnode_modulesintodocs/public/speedscope/, run automatically from thepredev/prebuildnpm hooks (it has to happen afternpm ci, so the Python figure generation cannot do it). - The run page embeds it in an iframe and points it at the profile with speedscope's
#profileURL=hash parameter.
docs/public/speedscope/ is generated and git-ignored, like docs/public/figures/.
Everything under docs/public/figures/cases/ is wiped and regenerated on each run, so artifacts from cases that no longer exist are not published.