Skip to content

[iOS] Pass NSTimeInterval instead of microseconds to Vsync tracing#186190

Merged
cbracken merged 1 commit into
flutter:masterfrom
cbracken:fix-scale-bug
May 7, 2026
Merged

[iOS] Pass NSTimeInterval instead of microseconds to Vsync tracing#186190
cbracken merged 1 commit into
flutter:masterfrom
cbracken:fix-scale-bug

Conversation

@cbracken

@cbracken cbracken commented May 7, 2026

Copy link
Copy Markdown
Member

Fixes an issue in FlutterVSyncClient where platform vsync timestamps were reported incorrectly to the timeline.

In #185918 I introduced the Obj-C tracing API, which originally used microseconds as an int64_t. During review this was updated to use NSTimeInterval to be more idiomatic and use a clear type in place of int64_t for the timestamp. The tests were updated but the callsite was not.

Authoring a test that would differentiate microseconds from fractional seconds (NSTimeInterval) is infeasible in the current state without significant refactoring, however, that refactoring is coming in followup patch:
#186166

That patch could be landed as an alternative as it also contains the fix.

Issue: #112232

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Fixes an issue in `FlutterVSyncClient` where platform vsync timestamps
were reported incorrectly to the timeline.

In flutter#185918 I introduced the Obj-C
tracing API, which originally used microseconds as an int64_t. During
review this was updated to use NSTimeInterval to be more idiomatic, and
type-safe -- as we see here, int64_t doesn't enforce units at all.

This fixes the timeline recording issue. This code will be replaced in a
followup that migrates off the C++ types entirely:
flutter#186166

Issue: flutter#112232
@cbracken cbracken requested a review from hellohuanlin May 7, 2026 14:52
@cbracken cbracken requested a review from a team as a code owner May 7, 2026 14:52
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 7, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added platform-ios iOS applications specifically engine flutter/engine related. See also e: labels. team-ios Owned by iOS platform team labels May 7, 2026
@cbracken cbracken changed the title [iOS] Pass seconds instead of microseconds to Vsync tracing [iOS] Pass NSTimeInterval instead of microseconds to Vsync tracing May 7, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the FlutterVSyncClient to use seconds as a floating-point value instead of microseconds when tracing platform vsync events. There are no review comments to address.

@stuartmorgan-g

Copy link
Copy Markdown
Contributor

test-exempt: refactoring that would negate the value of any added tests is already in review

@stuartmorgan-g stuartmorgan-g 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.

LGTM

It's almost like having a bunch of important Obj-C types just being typedefs of other types isn't great for compile-time correctness...

@cbracken

cbracken commented May 7, 2026

Copy link
Copy Markdown
Member Author

The way I propose to make this testable is to support injecting a trace writer into tracing via a Test extension somewhat similar to what I did with logging here (lines 239-243):

https://github.com/flutter/flutter/pull/185473/changes#diff-15896e8242d79e2e20a108c087a614d4c0126b74b2d412622a6282444a7be205R239-R243

The reference patch with the logging change won't land for unrelated reasons, but you get the idea.

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label May 7, 2026
@cbracken cbracken enabled auto-merge May 7, 2026 16:20
@cbracken cbracken added this pull request to the merge queue May 7, 2026
Merged via the queue into flutter:master with commit 30ad8ca May 7, 2026
201 checks passed
@cbracken cbracken deleted the fix-scale-bug branch May 7, 2026 19:01
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 7, 2026
@hellohuanlin hellohuanlin added the revert Autorevert PR (with "Reason for revert:" comment) label May 8, 2026
@auto-submit

auto-submit Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

A reason for requesting a revert of flutter/flutter/186190 could
not be found or the reason was not properly formatted. Begin a comment with 'Reason for revert:' to tell the bot why
this issue is being reverted.

@auto-submit auto-submit Bot removed the revert Autorevert PR (with "Reason for revert:" comment) label May 8, 2026
@hellohuanlin

Copy link
Copy Markdown
Contributor

Reason for revert: the previous PR caused a G3 crash, so I have to revert this too

@hellohuanlin hellohuanlin added the revert Autorevert PR (with "Reason for revert:" comment) label May 8, 2026
@auto-submit

auto-submit Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Unable to create the revert pull request due to ProcessException: Standard out
Auto-merging engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterVSyncClient.mm
CONFLICT (content): Merge conflict in engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterVSyncClient.mm
Standard error
error: could not revert 30ad8ca... [iOS] Pass NSTimeInterval instead of microseconds to Vsync tracing (#186190)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git revert --continue".
hint: You can instead skip this commit with "git revert --skip".
hint: To abort and get back to the state before "git revert",
hint: run "git revert --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Command: git revert --no-edit -m 1 30ad8ca

@auto-submit auto-submit Bot removed the revert Autorevert PR (with "Reason for revert:" comment) label May 8, 2026
@hellohuanlin

hellohuanlin commented May 8, 2026

Copy link
Copy Markdown
Contributor

This was rolled in by cl/912159861, before the root cause PR was rolled, so no need to revert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants