Skip to content

gpui: Add per-window frame-duration and present-interval histograms - #61871

Merged
rtfeldman merged 2 commits into
mainfrom
frame-duration-histograms
Aug 10, 2026
Merged

gpui: Add per-window frame-duration and present-interval histograms#61871
rtfeldman merged 2 commits into
mainfrom
frame-duration-histograms

Conversation

@rtfeldman

@rtfeldman rtfeldman commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

GPUI's input-latency histograms only sample frames that were preceded by input, so a window that janks while animating or while streaming content (agent panel output, terminal scrollback) never shows up in the fleet's latency reports. Hang detection catches outright stalls, but frames that are merely late — stutters in the 30–100ms range during animation — currently aren't visible anywhere.

This adds a frame-duration-histogram feature to GPUI with a per-window tracker recording two histograms: the duration of every Window::draw, and the interval between consecutively presented frames while the window is animating (a next-frame callback was already scheduled at the previous present, so frames are being produced back-to-back and a stretched interval means frames were missed). Intervals are only recorded for active windows, since inactive windows are deliberately throttled to a lower frame rate, and re-presents of unchanged frames (e.g. sustaining the display's refresh rate during high-rate input) are excluded. Zed enables the feature and reports both histograms every five minutes as a "Frame Duration Report" telemetry event alongside the existing "Latency Report", bucketed at roughly the 120Hz/60Hz/30Hz frame budgets so dropped-frame rates can be aggregated across the fleet.

Release Notes:

  • Added frame rendering performance to the diagnostics Zed collects when telemetry is enabled, to help find and fix stutters and dropped frames.

Input-latency histograms only sample frames that were preceded by input,
so jank during animations and streamed content (agent panel output,
terminal scrollback) is invisible in fleet telemetry. Add an opt-in
frame-duration-histogram feature that records how long every draw takes
and the interval between consecutively presented frames while a window
is animating, and report both from Zed as a Frame Duration Report
telemetry event alongside the existing latency report.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jul 29, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jul 29, 2026
@rtfeldman rtfeldman self-assigned this Jul 29, 2026
Both per-window baseline maps grew one entry per window forever; slotmap
window ids are never reused, so entries for closed windows were pure
leakage. Prune both maps against the open windows on each report.
@rtfeldman
rtfeldman marked this pull request as ready for review August 7, 2026 13:16

@Anthony-Eid Anthony-Eid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

approving this because it's needed but I think we should do a fast follow up on combining with the frame profiler bench app context uses as well.

@rtfeldman
rtfeldman added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit 9e23609 Aug 10, 2026
36 checks passed
@rtfeldman
rtfeldman deleted the frame-duration-histograms branch August 10, 2026 17:41
playdohface pushed a commit to playdohface/zed that referenced this pull request Aug 29, 2026
…ed-industries#61871)

GPUI's input-latency histograms only sample frames that were preceded by
input, so a window that janks while animating or while streaming content
(agent panel output, terminal scrollback) never shows up in the fleet's
latency reports. Hang detection catches outright stalls, but frames that
are merely late — stutters in the 30–100ms range during animation —
currently aren't visible anywhere.

This adds a `frame-duration-histogram` feature to GPUI with a per-window
tracker recording two histograms: the duration of every `Window::draw`,
and the interval between consecutively presented frames while the window
is animating (a next-frame callback was already scheduled at the
previous present, so frames are being produced back-to-back and a
stretched interval means frames were missed). Intervals are only
recorded for active windows, since inactive windows are deliberately
throttled to a lower frame rate, and re-presents of unchanged frames
(e.g. sustaining the display's refresh rate during high-rate input) are
excluded. Zed enables the feature and reports both histograms every five
minutes as a "Frame Duration Report" telemetry event alongside the
existing "Latency Report", bucketed at roughly the 120Hz/60Hz/30Hz frame
budgets so dropped-frame rates can be aggregated across the fleet.


Release Notes:

- Added frame rendering performance to the diagnostics Zed collects when
telemetry is enabled, to help find and fix stutters and dropped frames.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants