gfx-rs/wgpu
lock-analyzer
lock-analyzer (lock-analyzer/) is an offline tool that analyzes wgpu-core's lock acquisition order. It exists to make sure the project's static lock-rank discipline (wgpu-core/src/lock/) is actually being followed at runtime, with all the dynamic call paths real applications produce.
Purpose
- Consume a recording of lock acquire/release events produced by
wgpu-core(with extra-recording build features enabled). - Verify that the observed acquisition order matches the static lock graph.
- Surface call sites where a lock is taken at a "wrong" rank, even if the code panics weren't triggered in tests.
Directory layout
lock-analyzer/
├── Cargo.toml
└── src/ # small analyzerHow it relates to wgpu-core/src/lock/
The lock helpers in wgpu-core/src/lock/ (Mutex, RwLock, rank.rs) panic in debug builds when they detect a rank violation. That's the first line of defense. lock-analyzer is the second line: it can analyze a recording from a release build without panicking, and it can examine programs whose specific control flow doesn't hit a violation in the test suite.
Integration points
- Above: developers and maintainers of
wgpu-core. - Below: nothing automatic. Pair with a
wgpu-corebuild that records lock events.
Entry points for modification
If you add a new lock rank or a new lock pattern, this tool may need to learn about it. The analyzer is small and self-contained.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.