1PAPI_event_code_to_name(3) PAPI PAPI_event_code_to_name(3)
2
3
4
6 PAPI_event_code_to_name - convert a numeric hardware event code to a name.
7 PAPI_event_name_to_code - convert a name to a numeric hardware event code.
8
9
11 C Interface
12 #include <papi.h>
13 int PAPI_event_code_to_name(int EventCode, char *EventName);
14 int PAPI_event_name_to_code(char *EventName, int *EventCode);
15 Fortran Interface
16 #include fpapi.h
17 PAPIF_event_code_to_name(C_INT EventCode, C_STRING EventName, C_INT check)
18 PAPIF_event_name_to_code(C_STRING EventName, C_INT EventCode, C_INT check)
19
20
22 PAPI_event_code_to_name() is used to translate a 32-bit integer PAPI
23 event code into an ASCII PAPI event name. Either Preset event codes or
24 Native event codes can be passed to this routine. Native event codes
25 and names differ from platform to platform.
26
27 PAPI_event_name_to_code() is used to translate an ASCII PAPI event name
28 into an integer PAPI event code.
29
30
32 EventName -- a string containing the event name as listed in PAPI_pre‐
33 sets(3) or discussed in PAPI_native(3)
34
35 EventCode -- the numeric code for the event
36
38 On success, these functions return PAPI_OK.
39 On error, a non-zero error code is returned.
40
41
43 PAPI_EINVAL
44 One or more of the arguments is invalid.
45
46 PAPI_ENOTPRESET
47 The hardware event specified is not a valid PAPI preset.
48
49 PAPI_ENOEVNT
50 The hardware event is not available on the underlying hardware.
51
52
54 int EventCode, EventSet = PAPI_NULL;
55 char EventCodeStr[PAPI_MAX_STR_LEN];
56 char EventDescr[PAPI_MAX_STR_LEN];
57 char EventLabel[20];
58
59 /* Convert to integer */
60
61 if (PAPI_event_name_to_code("PAPI_TOT_INS",&EventCode) != PAPI_OK)
62 handle_error(1);
63
64 /* Create the EventSet */
65
66 if (PAPI_create_eventset(&EventSet) != PAPI_OK)
67 handle_error(1);
68
69 /* Add Total Instructions Executed to our EventSet */
70
71 if (PAPI_add_event(EventSet, EventCode) != PAPI_OK)
72 handle_error(1);
73
74
76 These functions have no known bugs.
77
78
80 PAPI_presets(3), PAPI_native(3), PAPI_enum_events(3),
81 PAPI_add_event(3), PAPI_remove_event(3), PAPI_get_event_info(3)
82
83
84
85
86PAPI Programmer's Reference September, 2004 PAPI_event_code_to_name(3)