EmbarkStudios / puffin

🐦 Friendly little instrumentation profiler for Rust 🦀
Apache License 2.0
1.49k stars 75 forks source link

Add setting for grid spacing on temporal axis #195

Closed chrisduerr closed 3 months ago

chrisduerr commented 8 months ago

Add the ability to change the spacing of the x-axis indicators from the default 10ms to an arbitrary interval. This is particularly useful to determine when a frame misses its desired vblank.


This change is primarily motivated by my own necessity to easily determine when a particular frame ran for over ~16ms and specifically which part of the flamegraph caused it to stretch beyond that limit. It's probably not the ideal solution, but I wanted to open up a PR to see if there's any interest in this feature from upstream.

One particularity of the current implementation is that 1, 10, 100, and 1000 all behave the same, since the interval is somewhat relative to the current viewport's width. I don't care about this since it doesn't really make a difference (you just need to zoom in/out), but I can see how that might be an undesired user experience.

https://github.com/EmbarkStudios/puffin/assets/8886672/6277f290-f93b-4603-bd58-3abd4c54d41c

chrisduerr commented 8 months ago

Would it make more to have an option to add an additional line at a user-specified time (e.g. 16.666ms)?

Do you mean drawing a separate vertical line in the grid? That certainly would be an option but I'm not sure how nicely that would look like when the two are close to each other. I'd also still want multiple lines, since it's good to know if a worst case missed one vblank, or two. Everyone knows about 16.6…, but 33.3… (at least to me) is usually acquired by some quick maths in my head, so it's nice to just have the indicators to clearly show you those intervals.