Skip to content

Access PAPI counters

Camille Coti requested to merge coti/simgrid:papi into master

As the title suggests, access PAPI counters.

In applications, two functions are important:

int simgrid_papi_get_num_counters();
void simgrid_get_papi_counters( long long* );

The first one returns the number of counters being used, the second time takes an array of long long and fills it with the counters' values. This array must be allocated by the application before simgrid_get_papi_counters() is called.

Internally, when smpi_bench_begin() starts, PAPI counters are started by simgrid_papi_start() and at the end of smpi_bench_end(), they are stopped by simgrid_papi_stop() and accumulated. This mechanism already existed in SimGrid and makes sure that each process gets hardware counter values for its "time slot" of the simulator.

This patch puts the start/stop actions in separate functions that can be called from somewhere else. Henceforth, simgrid_get_papi_counters() adds the current values to what has already been accumulated for the current process.

Merge request reports