puffin
puffin copied to clipboard
Viewer labeling scopes wrong when restarting app
Describe the bug
When you restart the application that you're profiling and have removed or otherwise changed the profiling scopes, puffin_viewer
will mislabel the scopes. Specifically, every scope that follows the removed scope in initialization order will be labeled as the previous scope in initialization order. This can be especially bad in multithreaded applications where scope initialization order can differ between application restarts, without having to change the code at all.
Workaround: Restarting puffin_viewer
each time you profile.
To Reproduce Steps to reproduce the behavior:
- Start
puffin_viewer
- In this repo, run the server example with
cargo run --example server
- Observe the viewer showing correct profile data
- Remove the following profile scope from
puffin_http/examples/server.rs
line 16:
puffin::profile_scope!("main_loop", format!("frame {frame_counter}"));
- restart only the server
- Observe the viewer mislabeling all scopes
Expected behavior The profiler correctly labeling all scopes :D
Screenshots
First run:
Second run with a scope removed:
Device:
- OS: KUbuntu 24.04
- Browser N/A
- puffin_viewer 0.21.1
Additional context Thanks for making this simple yet awesome profiler :heart:
Also it would be nice if you'd add to puffin_viewer
's readme that sudo apt install libgtk-3-dev
is required on Linux. Thanks