sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

Track macOS apps running under Rosetta

Open armcknight opened this issue 3 years ago • 0 comments

Description

Could be nice to be able to segment sessions/transactions/profiles by apps compiled natively on Apple Silicon vs an x86 binary translated to M1 via Rosetta, and/or provide a special icon/treatment anytime we display that something ran on Silicon.

We can determine if an app is running under rosetta thusly: https://developer.apple.com/forums/thread/659846

int processIsTranslated() { // lightly edited from above source
    int ret = 0;
    size_t size = sizeof(ret);
    if (sysctlbyname("sysctl.proc_translated", &ret, &size, NULL, 0) == -1)
    {
        if (errno == ENOENT) 
        {
            return 0;
        }
        return -1;
    }
    return ret;
}

armcknight avatar Sep 20 '22 21:09 armcknight