Skip to content

Instantly share code, notes, and snippets.

View arav12ind's full-sized avatar

Sai Aravind arav12ind

  • (NULL) - student
  • Chennai, India
View GitHub Profile
@arav12ind
arav12ind / kpc_demo.c
Created December 26, 2024 07:47 — forked from ibireme/kpc_demo.c
A demo shows how to read Intel or Apple M1 CPU performance counter in macOS.
// =============================================================================
// XNU kperf/kpc demo
// Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges
//
//
// Demo 1 (profile a function in current thread):
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database.
// M1 (Pro/Max/Ultra): /usr/share/kpep/a14.plist
// M2 (Pro/Max): /usr/share/kpep/a15.plist
// M3: /usr/share/kpep/as1.plist