Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frame time graph to fps_overlay #12561

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

IceSentry
Copy link
Contributor

Objective

Frame time is often more important to know than FPS but because of the temporal nature of it, just seeing a number is not enough. Seeing a graph that shows the history makes it easier to reason about performance.

Solution

This PR adds a bar graph of the frame time history.

Each bar is scaled based on the frame time where a bigger frame time will give a taller and wider bar.

The color also scales with that frame time where red is at or bellow the minimum target fps and green is at or above the target maximum frame rate. Anything between those 2 values will be interpolated between green and red based on the frame time.

The algorithm is highly inspired by this article: https://asawicki.info/news_1758_an_idea_for_visualization_of_frame_times

fps_overlay_3ssB8joFc9

@IceSentry IceSentry added A-Dev-Tools Tools used to debug Bevy applications. A-Diagnostics Logging, crash handling, error reporting and performance analysis A-Rendering Drawing game state to the screen labels Mar 18, 2024
@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible M-Needs-Release-Note Work that should be called out in the blog due to impact labels Mar 18, 2024
@alice-i-cecile alice-i-cecile added this to the 0.14 milestone Mar 18, 2024
Copy link
Contributor

@bushrat011899 bushrat011899 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor comments, otherwise this looks great!

crates/bevy_dev_tools/src/fps_overlay.rs Outdated Show resolved Hide resolved
crates/bevy_dev_tools/src/fps_overlay.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@pablo-lua pablo-lua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with what we have now, very good tool! I hope we can make it be more customizable in the future, but that can be a follow up.

@matiqo15 matiqo15 added the S-Blocked This cannot move forward until something else changes label Mar 19, 2024
@matiqo15
Copy link
Member

Blocked before up-streaming iyes_perf_ui - see discord

@IceSentry
Copy link
Contributor Author

Alright, I extracted all the logic to it's own plugin. Technically, this also helps with making it less blocked because the plugin can exist on it's own.

@torsteingrindvik this should make it work with your requested use case of spawning it yourself.

@torsteingrindvik
Copy link
Contributor

Alright, I extracted all the logic to it's own plugin. Technically, this also helps with making it less blocked because the plugin can exist on it's own.

@torsteingrindvik this should make it work with your requested use case of spawning it yourself.

Thanks, if I'm following correctly I'd then just add

FrameTimeGraphPlugin

to my app then spawn the material in my UI somewhere and it should work, which is nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Dev-Tools Tools used to debug Bevy applications. A-Diagnostics Logging, crash handling, error reporting and performance analysis A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible M-Needs-Release-Note Work that should be called out in the blog due to impact S-Blocked This cannot move forward until something else changes
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

6 participants