THREAD_TIME_CONSTRAINT_POLICY for Apple Silicon

Hello,

I use https://juce.com to develop an audio app for macOS.

With previous macOSes on Intel, I used THREAD_TIME_CONSTRAINT_POLICY as described in https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html to set real time priority for the audio processing thread, according to CPU usage values.

Juce has an API to get the CPU frequency so I was able to set usage values.

With macOS Monterey on Apple Silicon, the Juce API is unable to give the CPU frequency (the getCpuSpeedInMegahertz API just returns 0).

Is THREAD_TIME_CONSTRAINT_POLICY still valid on latest macOS on Apple Silicon?

If so, what CPU frequency value should be used - ie how can we determine it?

If not, how should the real time priority be set?

Thanks! -Mathieu

Fyi Juce code to get CPU (SystemStats::getCpuSpeedInMegahertz) can be found at https://github.com/juce-framework/JUCE/blob/master/modules/juce_core/native/juce_mac_SystemStats.mm