The Linux perf utility is available via the command line. see man perf. Here we show an example of calling perf's API in demo_perf.c Examples: gcc demo_perf.c ./a.out ...