added: scripts/profile/view.sh — auto-pick newest artifact and open viewer

Dispatches by extension: .prof -> snakeviz, memray .bin -> memray flamegraph
(overridable via VIEW=table|tree|stats|summary|leaks), .svg/.html -> xdg-open.
Positional arg can be a file path or a type keyword (cprofile, memray, pyspy,
pyinstrument).
This commit is contained in:
2026-04-17 13:20:05 -04:00
parent ba448bae13
commit 6572c5cbaf
2 changed files with 88 additions and 0 deletions

View File

@@ -67,6 +67,27 @@ Hunt leaks and allocation hot spots in the API / workers.
memray flamegraph profiles/memray.bin
```
## Viewing artifacts
All profiling outputs land under `./profiles/`. Use the viewer wrapper to
auto-pick the newest file and launch the right tool:
```bash
./scripts/profile/view.sh # newest artifact of any kind
./scripts/profile/view.sh cprofile # newest .prof -> snakeviz
./scripts/profile/view.sh memray # newest memray .bin -> flamegraph
./scripts/profile/view.sh pyinstrument # newest .html -> browser
./scripts/profile/view.sh path/to/file # explicit file
# Memray view modes:
VIEW=flamegraph ./scripts/profile/view.sh memray # default
VIEW=table ./scripts/profile/view.sh memray
VIEW=tree ./scripts/profile/view.sh memray # terminal
VIEW=stats ./scripts/profile/view.sh memray # terminal summary
VIEW=summary ./scripts/profile/view.sh memray # top allocators
VIEW=leaks ./scripts/profile/view.sh memray # leak-filtered flamegraph
```
## Load generation
Pair any of the in-process lenses (2, 5) with Locust for realistic traffic: