I wanted to measure a couple of native events on a Nehalem machine (OFFCORE_RESPONSE_0:LOCAL_DRAM, OFFCORE_RESPONSE_0:REMOTE_DRAM). `papi_event_chooser' reports that these can be measured:
$ papi_event_chooser NATIVE OFFCORE_RESPONSE_0:REMOTE_DRAM OFFCORE_RESPONSE_0:LOCAL_DRAM | tail -n 2
Total events reported: 93
So I wrote a small program that uses the PAPI APIs (PAPI_create_eventset(), PAPI_add_event(), PAPI_start()) that measures these two counters for a sample loop. However, PAPI_start() fails with PAPI_ESYS and perror() prints: "Operation not permitted".
This machine has a 2.6.18 kernel with the perfctr patch.
Any clue whats wrong?