1PAPI_start(3) PAPI PAPI_start(3)
2
3
4
6 PAPI_start - start counting hardware events in an event set
7
8 PAPI_stop - stop counting hardware events in an event set
9
10
12 C Interface
13 #include <papi.h>
14 int PAPI_start(int EventSet);
15 int PAPI_stop(int EventSet, long_long *values);
16 Fortran Interface
17 #include fpapi.h
18 PAPIF_start(C_INT EventSet, C_INT check)
19 PAPIF_stop(C_INT EventSet, C_LONG_LONG(*) values, C_INT check)
20
21
23 PAPI_start starts counting all of the hardware events contained in the
24 previously defined EventSet. All counters are implicitly set to zero
25 before counting.
26
27 PAPI_stop halts the counting of a previously defined event set and the
28 counter values contained in that EventSet are copied into the values
29 array
30
31 These calls assume an initialized PAPI library and a properly added
32 event set.
33
34
36 EventSet -- an integer handle for a PAPI event set as created by
37 PAPI_create_eventset(3)
38
39 *values -- an array to hold the counter values of the counting events
40
41
43 On success, this function returns PAPI_OK.
44 On error, a non-zero error code is returned.
45
46
48 PAPI_EINVAL
49 One or more of the arguments is invalid.
50
51 PAPI_ESYS
52 A system or C library call failed inside PAPI, see the errno
53 variable.
54
55 PAPI_ENOEVST
56 The EventSet specified does not exist.
57
58 PAPI_EISRUN
59 The EventSet is currently counting events. (PAPI_start() only)
60
61 PAPI_ENOTRUN
62 The EventSet is currently not running. (PAPI_stop() only)
63
64 PAPI_ECNFLCT
65 The underlying counter hardware can not count this event and
66 other events in the EventSet simultaneously. (PAPI_start()
67 only)
68
69 PAPI_ENOEVNT
70 The PAPI preset is not available on the underlying hardware.
71
72
74 if (PAPI_create_eventset(&EventSet) != PAPI_OK)
75 handle_error(1);
76
77 /* Add Total Instructions Executed to our EventSet */
78 if (PAPI_add_event(EventSet, PAPI_TOT_INS) != PAPI_OK)
79 handle_error(1);
80
81 /* Start counting */
82 if (PAPI_start(EventSet) != PAPI_OK)
83 handle_error(1);
84
85 poorly_tuned_function();
86
87 if (PAPI_stop(EventSet, values) != PAPI_OK)
88 handle_error(1);
89
90 printf("%lld\n",values[0]);
91
92
94 These functions have no known bugs.
95
96
98 PAPI_create_eventset(3), PAPI_add_event(3), PAPI(3), PAPIF(3)
99
100
101
102PAPI Programmer's Reference September, 2004 PAPI_start(3)