Skip to content

RFC: GetTime() timestamp for iOS ARM #1245

Open

Description

@slomp

This is a follow-up to #1237 (merged here: #1239).

Right now, we are using mach_absolute_time() for iOS timestamps:

# if defined TARGET_OS_IOS && TARGET_OS_IOS == 1
if( HardwareSupportsInvariantTSC() ) return mach_absolute_time();

We should be able to use ARM64's CNTKCTL_EL0 instruction on iOS.
According to Apple's XNU kernel, access to the CNTKCTL register(s) from user-space (EL0 ring) is granted:
https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/arm64/machine_routines.c#L2606-L2612

Activity

  1. Hanflipped commented on Dec 30, 2025

    @Hanflipped

    Hi! I noticed you previously contributed changes related to MetalTracy.hmm.

    Recently I’ve been running into an issue where CPU and GPU timing cannot be aligned in Tracy when using the Metal GPU context,Have you ever encountered a similar CPU↔GPU time alignment problem with the Metal integration? If so, could you share any hints on what the correct synchronization/calibration approach is
    The problem is 1247
    Thanks a lot for your time!

  2. slomp commented on Dec 30, 2025

    @slomp
    CollaboratorAuthor

    @Hanflipped Let's control the variables here.

    Is the problem you are experiencing with Metal related to this current issue here (or rather, to this PR #1239 that was recently merged)?

    Or did it start happening prior to that?
    Can you pinpoint the Tracy version or commit hash of when you started experiencing the issue?

  3. Hanflipped commented on Dec 31, 2025

    @Hanflipped

    @Hanflipped Let's control the variables here.

    Is the problem you are experiencing with Metal related to this current issue here (or rather, to this PR #1239 that was recently merged)?

    Or did it start happening prior to that? Can you pinpoint the Tracy version or commit hash of when you started experiencing the issue?

    Hi, @slomp ,It’s not related to this current issue (or PR #1239). I was already seeing it before that.

    The version I’m building is tag v0.13.0.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions