Add FrameTimeGraph: per-frame times against a budget - #575
Merged
Merged
Conversation
FrameTimeGraph draws per-frame times as bars, newest on the right, against a budget line and a second line at twice the budget. Bars over budget take the warning colour, bars over twice it the error colour, and a spike past the scale gets a cap at the top edge. Hovering a bar shows its time, rate and age, and an optional row underneath reads out the average, 99th percentile, worst frame and over-budget count. It takes a span of milliseconds, or a caller-owned FrameTimeHistory ring buffer fed once a frame, and draws only as many of the newest frames as the box has pixels. Histogram's bar loop moves into a shared DrawBars helper so both widgets draw bars the same way; Histogram's output is unchanged. Closes #531 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MBhLQ3ZkoYk8s5tKQ8RTAP
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HgjMCJ9MQRmUk6c8KABDYH
The restack merge left five image-and-colour demo tests from the layers below at the end of the file, so this PR's diff showed them as moved and drew review comments on code that is not part of it. The file is now the base's copy plus the FrameTimeGraph entry and test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MBhLQ3ZkoYk8s5tKQ8RTAP
Sonar S3358 flagged HistogramBarColors.ColorFor. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MBhLQ3ZkoYk8s5tKQ8RTAP
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HgjMCJ9MQRmUk6c8KABDYH
|
This was referenced Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Requested by Matt · project thread
Before:
ktsu.ImGui.Widgetshad no frame-time display. A caller who wanted to see hitches drew a plainHistogramor an ImGui plot of the times, with no budget line and nothing to separate an over-budget frame from a normal one.After:
ImGuiWidgets.FrameTimeGraphdraws per-frame times as bars, newest on the right, against a budget line and a second line at twice the budget. Bars over budget use the warning colour and bars over twice it use the error colour. A spike past the scale gets a cap at the top edge. Hovering a bar shows its time, rate and age. An optional row underneath reads out the average, the 99th percentile, the worst frame and the over-budget count. The widget marks itself withImGuiProbes.MarkItem.How:
FrameTimeHistoryring buffer fed once a frame. It draws only as many of the newest frames as the box has pixels.Histogram's bar loop moves into a sharedDrawBarshelper, so both widgets draw bars the same way.Histogram's output is unchanged.FrameTimeGraphDemoregistered with one line inDemoSections.cs, state tests inImGui.Widgets.Tests, an isolation suite inImGui.Widgets.UITests, and a gallery tile.This PR is stacked on the widget stack (#536 → #539 → #540 → #542) and targets the top of it,
claude/asset-browser-026l9x, so only the FrameTimeGraph commit shows in the diff.Closes #531
🤖 Generated with Claude Code
https://claude.ai/code/session_01MBhLQ3ZkoYk8s5tKQ8RTAP
Generated by Claude Code