1PAPI_query_event(3) PAPI PAPI_query_event(3)
2
3
4
6 PAPI_query_event - query if PAPI event exists
7
8
10 C Interface
11 #include <papi.h>
12 int PAPI_query_event(int EventCode);
13 Fortran Interface
14 #include fpapi.h
15 PAPIF_query_event(C_INT EventCode, C_INT check)
16
17
19 PAPI_query_event() asks the PAPI library if the PAPI Preset event can
20 be counted on this architecture. If the event CAN be counted, the func‐
21 tion returns PAPI_OK. If the event CANNOT be counted, the function
22 returns an error code. This function also can be used to check the
23 syntax of a native event.
24
25
27 EventCode -- a defined event such as PAPI_TOT_INS.
28
30 On success, PAPI_query_event returns PAPI_OK
31 On error, a non-zero error code is returned.
32
33
34
36 PAPI_EINVAL
37 One or more of the arguments is invalid.
38
39 PAPI_ENOTPRESET
40 The hardware event specified is not a valid PAPI preset.
41
42 PAPI_ENOEVNT
43 The PAPI preset is not available on the underlying hardware.
44
45
47 int retval;
48
49 /* Initialize the library */
50
51 retval = PAPI_library_init(PAPI_VER_CURRENT);
52
53 if (retval != PAPI_VER_CURRENT) {
54 fprintf(stderr,"PAPI library init error!\n");
55 exit(1); }
56
57 if (PAPI_query_event(PAPI_TOT_INS) != PAPI_OK) {
58 fprintf(stderr,"No instruction counter? How lame.\n");
59 exit(1);
60 }
61
62
63
65 These functions have no known bugs.
66
67
69 PAPI_preset(3), PAPI_native(3), PAPI_remove_event(3),
70 PAPI_remove_events(3),
71
72
73
74
75PAPI Programmer's Reference September, 2004 PAPI_query_event(3)