Use SMAppService if macOS >= 13 and improve performance slightly#80
Use SMAppService if macOS >= 13 and improve performance slightly#80uthiel wants to merge 4 commits intomacmade:mainfrom
Conversation
I love transitioning to this! Just started using Though also, on the new Apple Silicon computers I'm not sure if and the So it's unclear to me if this code even needs to be ran on Apple Silicon machines at all. |
It doesn't. That's why the last commit executes it only on x86. |
| } | ||
|
|
||
| status.deallocate() | ||
| #endif |
There was a problem hiding this comment.
Seems that the new code runs only on x86_64, and no code running on arm64. Did you test this on Apple silicon?
With macOS 13, Apple introduced a drastically simplified way of launching an app at login, SMAppService. This PR encapsulates the new API into an availability check in order to preserve downward compatibility.
thermal stats are currently read by executing
/usr/bin/pmsetand parsing the result, which is inefficient and fragile. This PR calls IOPMCopyCPUPowerStatus directly just like pmset does which mainly results in more stable code but also a ~3% performance gain on x86_64 or ~6% on arm64e.