The PERF_RECORD_MISC_GUEST_KERNEL and PERF_RECORD_MISC_GUEST_USER macros were not defined in perf_events until ~2.6.35 kernel version (I think). Attempts to build operf on vanilla kernel.org kernel headers between 2.6.31 and 2.6.35 will fail with the following error:
operf_utils.cpp: In function ‘void __handle_sample_event(event_t*, u64)’:
operf_utils.cpp:735: error: ‘PERF_RECORD_MISC_GUEST_KERNEL’ was not declared in this scope
operf_utils.cpp:738: error: ‘PERF_RECORD_MISC_GUEST_USER’ was not declared in this scope
We should add something to configure.ac to check for existence of these macros and then put some #ifdef's around the one spot in the code where they are found.