Skip to content

Instantly share code, notes, and snippets.

@gchavez2
Last active August 29, 2015 14:19
Show Gist options
  • Save gchavez2/abea27605b6259c9dc17 to your computer and use it in GitHub Desktop.
Save gchavez2/abea27605b6259c9dc17 to your computer and use it in GitHub Desktop.
Necessary additions to C file to get access to performance counters
#include <papi.h>
#define NUM_EVENTS 1
int main ( int argc, char ** argv ) {
int Events[NUM_EVENTS] = {PAPI_TLB_DM}; //Data TLB misses
<your code>
PAPI_read_counters(values, NUM_EVENTS);
printf("PAPI_TLB_DM = %lld \n",values[0]);
PAPI_stop_counters(values, NUM_EVENTS);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment