I need to read some of the information reported by powermetrics(1), but don't want to invoke powermetrics(1). It turns out I have to use IOReport functions to retrieve data from kernel side IOKit modulars. Unfortunately, I could not find documentation on using IOReport in user-level programs. Fortunately, there are kernel side code comments, such as [1], and some user-space source code open-sourced by Apple, e.g. [2]. With them and some previous work such as [3], I put together this example that could dump all the IOReport information it could access.
Tested on some MacOS machines and jailbroken iDevices.
[1] IOReporter.h
[2] pmset.c