PAPI3:PAPI list events.3
From PAPIDocs
Jump to: navigation, search


NAME

  • PAPI_list_events - list the events in an event set

Synopsis

C Interface

#include papi.h
int PAPI_list_events(int  EventSet, int * Events, int * number );

Fortran Interface

#include fpapi.h
PAPIF_list_events(C_INT  EventSet,  C_INT(*)  Events,  C_INT  number,  C_INT  check )

Description

PAPI_list_events() decomposes an event set into the hardware events it contains.

This call assumes an initialized PAPI library and a successfully added event set.

Arguments

EventSet -- An integer handle for a PAPI event set as created by PAPI_create_eventset (3).

*Events -- An array of codes for events, such as PAPI_INT_INS. No more than *number codes will be stored into the array.

*number -- On input the variable determines the size of the Events array. On output the variable contains the number of counters in the event set.

Note that if the given array Events is too short to hold all the counters in the event set the *number variable will be greater than the actually stored number of counter codes.

Examples

/* Convert an event name to an event code */
if (PAPI_event_name_to_code("PAPI_TOT_INS",&EventCode) != PAPI_OK)
exit(1);
/* Add Total Instructions Executed to our EventSet */
if (PAPI_add_event(EventSet, EventCode) != PAPI_OK)
exit(1);
/* Convert a second event name to an event code */
if (PAPI_event_name_to_code("PAPI_L1_LDM",&EventCode) != PAPI_OK)
exit(1);
/* Add L1 Load Misses to our EventSet */
if (PAPI_add_event(EventSet, EventCode) != PAPI_OK)
exit(1);
/* List the events in our EventSet */
number = 4;
if(PAPI_list_events(EventSet, Events, &number);
exit(1);
if(number != 2)
exit(1);

Bugs

This function has no known bugs.

See Also

PAPI_event_code_to_name(3), PAPI(3), PAPI_event_name_to_code(3), PAPI_add_event(3), PAPI_create_eventset(3)