darwin-kperf-sys
Raw bindings to Apple's performance-counter frameworks
IntroductionCopy link to this section
darwin-kperf-sys provides raw Rust FFI bindings to Apple's private kperf.framework and kperfdata.framework. It supplies the low-level interfaces used by darwin-kperf.
Published release: 0.1.1 on crates.io.
InstallationCopy link to this section
cargo add darwin-kperf-sysFramework accessCopy link to this section
The kperf module exposes counter configuration, reads, and sampling interfaces. The kperfdata module exposes the event database used to translate event selections into counter configurations. The load module loads the frameworks and resolves their function pointers at runtime.
These bindings target macOS on x86_64 and aarch64. Calls into the frameworks are unsafe: callers must satisfy the documented pointer, buffer, and threading requirements. The private framework ABI can change between macOS releases, and acquiring or reading certain counters requires root privileges.
Use darwin-kperf for its safe Rust interface when it covers your use case. For direct framework access, consult the API and safety documentation and source.