1PAPI_list_events(3) PAPI PAPI_list_events(3)
2
3
4
6 PAPI_list_events - list the events in an event set
7
9 C Interface
10
11 #include "papi.h"
12 int PAPI_list_events(int EventSet, int *Events, int *number);
13
14 Fortran Interface
15
16 #include "fpapi.h"
17 PAPIF_list_events(C_INT EventSet, C_INT(*) Events, C_INT number, C_INT check)
18
19
21 PAPI_list_events() decomposes an event set into the hardware events it
22 contains.
23
24 This call assumes an initialized PAPI library and a successfully added
25 event set.
26
27
29 EventSet -- An integer handle for a PAPI event set as created by
30 PAPI_create_eventset(3).
31
32 *Events -- An array of codes for events, such as PAPI_INT_INS. No more
33 than *number codes will be stored into the array.
34
35 *number -- On input the variable determines the size of the Events
36 array. On output the variable contains the number of counters in the
37 event set.
38
39 Note that if the given array Events is too short to hold all the coun‐
40 ters in the event set the *number variable will be greater than the
41 actually stored number of counter codes.
42
43
45 PAPI_OK
46 The call returned successfully.
47
48 PAPI_EINVAL
49 One or more of the arguments is invalid.
50
51 PAPI_ENOEVST
52 The EventSet specified does not exist.
53
54
56 /* Convert an event name to an event code */
57 if (PAPI_event_name_to_code("PAPI_TOT_INS",&EventCode) != PAPI_OK)
58 exit(1);
59
60 /* Add Total Instructions Executed to our EventSet */
61 if (PAPI_add_event(EventSet, EventCode) != PAPI_OK)
62 exit(1);
63
64 /* Convert a second event name to an event code */
65 if (PAPI_event_name_to_code("PAPI_L1_LDM",&EventCode) != PAPI_OK)
66 exit(1);
67
68 /* Add L1 Load Misses to our EventSet */
69 if (PAPI_add_event(EventSet, EventCode) != PAPI_OK)
70 exit(1);
71
72 /* List the events in our EventSet */
73 number = 4;
74 if(PAPI_list_events(EventSet, Events, &number);
75 exit(1);
76
77 if(number != 2)
78 exit(1);
79
80
82 This function has no known bugs.
83
84
86 PAPI_event_name_to_code(3), PAPI_add_event(3), PAPI_create_eventset(3),
87 PAPI_event_code_to_name(3), PAPI(3),
88
89
90
91PAPI Programmer's Reference September, 2004 PAPI_list_events(3)