Instrumentation using hardware counters on SGI Origin machines?

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

paramnt/tools/instrumentation.
This libaray satisfies the interface of instrumentation in polaris.

Usage

Step 1: Using polaris to do the instrumentation.
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.

cc -O2 -mp interval_perfex.c
For multiple processors, please define _OPENMP and _MT
cc -O2 -mp -D_OPENMP -D_MT interval_perfex.c
Step 3: Compile with the instrumented code.
Make sure you linked the perfex libarary (-lperfex).

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!