1PAPI_state(3) PAPI PAPI_state(3)
2
3
4
6 PAPI_state - return the counting state of an EventSet
7
8
10 C Interface
11 #include <papi.h>
12 int PAPI_state (int EventSet, int *status);
13 Fortran Interface
14 #include fpapi.h
15 PAPIF_state(C_INT EventSet, C_INT status, C_INT check)
16
17
19 PAPI_state() returns the counting state of the specified event set.
20
21
23 EventSet -- an integer handle for a PAPI event set as created by
24 PAPI_create_eventset(3)
25
26 status -- an integer containing a boolean combination of one or more of
27 the following nonzero constants as defined in the PAPI header file
28 papi.h:
29
30
31 ┌──────────────────┬──────────────────────────────────────────────┐
32 │PAPI_STOPPED │ EventSet is stopped │
33 ├──────────────────┼──────────────────────────────────────────────┤
34 │PAPI_RUNNING │ EventSet is running │
35 ├──────────────────┼──────────────────────────────────────────────┤
36 │PAPI_PAUSED │ EventSet temporarily disabled by the library │
37 ├──────────────────┼──────────────────────────────────────────────┤
38 │PAPI_NOT_INIT │ EventSet defined, but not initialized │
39 ├──────────────────┼──────────────────────────────────────────────┤
40 │PAPI_OVERFLOWING │ EventSet has overflowing enabled │
41 ├──────────────────┼──────────────────────────────────────────────┤
42 │PAPI_PROFILING │ EventSet has profiling enabled │
43 ├──────────────────┼──────────────────────────────────────────────┤
44 │PAPI_MULTIPLEXING │ EventSet has multiplexing enabled │
45 ├──────────────────┼──────────────────────────────────────────────┤
46 │PAPI_ACCUMULATING │ reserved for future use │
47 ├──────────────────┼──────────────────────────────────────────────┤
48 │PAPI_HWPROFILING │ reserved for future use │
49 └──────────────────┴──────────────────────────────────────────────┘
50
52 On success, this function returns PAPI_OK.
53 On error, a non-zero error code is returned.
54
55
57 PAPI_EINVAL
58 One or more of the arguments is invalid.
59
60 PAPI_ENOEVST
61 The EventSet specified does not exist.
62
63
65 int EventSet = PAPI_NULL;
66 int status = 0;
67
68 if (PAPI_create_eventset(&EventSet) != PAPI_OK)
69 handle_error(1);
70
71 /* Add Total Instructions Executed to our EventSet */
72
73 if (PAPI_add_event(EventSet, PAPI_TOT_INS) != PAPI_OK)
74 handle_error(1);
75
76 /* Start counting */
77
78 if (PAPI_state(EventSet, &status) != PAPI_OK)
79 handle_error(1);
80
81 printf("State is now %d\n",status);
82
83 if (PAPI_start(EventSet) != PAPI_OK)
84 handle_error(1);
85
86 if (PAPI_state(EventSet, &status) != PAPI_OK)
87 handle_error(1);
88
89 printf("State is now %d\n",status);
90
91
93 This function has no known bugs.
94
95
97 PAPI_start(3), PAPI_stop(3)
98
99
100
101PAPI Programmer's Reference September, 2004 PAPI_state(3)