You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: Normalize js_refresh_rate against actual screen fps - #1464
This PR fixes the js_refresh_rate normalization. It normalizes fps metrics into a 0-60fps range, but it always did so against the screen's maximum possible refresh rate rather than the rate the screen is actually running at. On high refresh rate screens running below their maximum (e.g. a 120Hz panel running at 60Hz), a healthy JS thread was reported at ~30fps.
The current refresh rate now comes from CADisplayLink's targetTimestamp on iOS and from the default display's Display.refreshRate on Android, and is passed to the existing normalization functions in place of the maximum.
Android below API 30: we keep normalizing against the maximum refresh rate. Before API 30 Display.refreshRate isn't cached and every read is an IPC to the system, which we don't want on every JS frame (dd-sdk-android doesn't read it below API 30 either).
Motivation
The calculation of js_refresh_rate should be accurate under all circumstances.
Review checklist (to be filled by reviewers)
Feature or bugfix MUST have appropriate tests
Make sure you discussed the feature or bugfix with the maintaining team in an Issue
Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
If this PR is auto-generated, please make sure also to manually update the code related to the change
The display is also supplied when frame-rate vitals are disabled but JavaScript long-task monitoring is enabled. In that supported configuration, FpsFrameCallback now reads display.refreshRate on every JS-thread frame even though buildFrameTimeCallback discards the value, adding continuous overhead unrelated to the enabled feature. Only resolve/pass the display when the vitals frequency is not NEVER.
sbarrio
deleted the
sbarrio/fix/refresh-rate-normalization-against-current-screen-fps
branch
October 5, 2026 08:50
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
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.
What does this PR do?
This PR fixes the
js_refresh_ratenormalization. It normalizes fps metrics into a 0-60fps range, but it always did so against the screen's maximum possible refresh rate rather than the rate the screen is actually running at. On high refresh rate screens running below their maximum (e.g. a 120Hz panel running at 60Hz), a healthy JS thread was reported at ~30fps.The current refresh rate now comes from
CADisplayLink'stargetTimestampon iOS and from the default display'sDisplay.refreshRateon Android, and is passed to the existing normalization functions in place of the maximum.Android below API 30: we keep normalizing against the maximum refresh rate. Before API 30
Display.refreshRateisn't cached and every read is an IPC to the system, which we don't want on every JS frame (dd-sdk-android doesn't read it below API 30 either).Motivation
The calculation of
js_refresh_rateshould be accurate under all circumstances.Review checklist (to be filled by reviewers)