There is a command called "perfex", which could be used to get access to the hardware counters. Using its library -- libperfex we implement the instrumentation as well for polaris. The source file is interval_perfex.c provided in
Please switch "instrument" on. You had better switch "instr_pcl" on, if you are inerested in all the processors.
Step 2: Compile the instrumentation code.
Step 4: Set the environment. You can use two different counters at once. There are two corresponding environment variables T5_EVENT0 and T5_EVENT1. In order to know the values to be set, please see the man page of perfex.
LAST STEP: Run the program!