add --cprofile flag with periodic dump

This commit is contained in:
Username
2026-02-24 13:18:10 +01:00
parent ee145b4071
commit f77375422a
2 changed files with 75 additions and 1 deletions

View File

@@ -22,6 +22,26 @@ tuimble --host mumble.example.com --user myname
- **toggle** — press to start, press again to stop (default)
- **hold** — hold key to transmit, release to stop (requires evdev)
## Profiling
```sh
tuimble --cprofile # saves to ~/.config/tuimble/profile.prof
tuimble --cprofile /tmp/tuimble.prof # saves to custom path
```
Profile data is dumped every 30 seconds and on exit, so snapshots
are available even after a crash or `kill`. Output is standard `.prof`
format:
```sh
python3 -m pstats /tmp/tuimble.prof # interactive explorer
# or install snakeviz for a browser-based flamegraph:
# pip install snakeviz && snakeviz /tmp/tuimble.prof
```
Note: cProfile captures the main thread only. Background workers
started with `@work(thread=True)` are not included.
## Configuration
See `~/.config/tuimble/config.toml`. All fields are optional;