I'm trying to get the idle residency of the CPU in macOS (C-State C0 residency on x86 unsure on arm64). I am aware you can find this info by running something like sudo powermetrics -i1 -n1 -s cpu_power | grep residency
in the terminal, but I need a way to pull this info using C, C++, Objective-C, or even Assembly...especially in a way that doesn't need admin privileges.
All I can find regarding this topic is this: Time each CPU core spends in C0 power state, but the answers are not the clearest. Please help!