1PAPI_read_counters(3) PAPI PAPI_read_counters(3)
2
3
4
6 PAPI_read_counters - PAPI High Level: read and reset counters
7
8 PAPI_accum_counters - PAPI High Level: accumulate and reset counters
9
10
12 C Interface
13 #include <papi.h>
14 int PAPI_read_counters(long_long *values, int array_len);
15 int PAPI_accum_counters(long_long *values, int array_len);
16 Fortran Interface
17 #include fpapi.h
18 PAPIF_read_counters(C_LONG_LONG(*) values, C_INT array_len, C_INT check)
19 PAPIF_accum_counters(C_LONG_LONG(*) values, C_INT array_len, C_INT check)
20
21
23 PAPI_read_counters() copies the event counters into the array values
24 The counters are reset and left running after the call.
25
26 PAPI_accum_counters() adds the event counters into the array values
27 The counters are reset and left running after the call.
28
29 These calls assume an initialized PAPI library and a properly added
30 event set.
31
32
34 *values -- an array to hold the counter values of the counting events
35
36 array_len -- the number of items in the *events array
37
39 On success, these functions return PAPI_OK.
40 On error, a non-zero error code is returned.
41
42
44 PAPI_EINVAL
45 One or more of the arguments is invalid.
46
47 PAPI_ESYS
48 A system or C library call failed inside PAPI, see the errno
49 variable.
50
51
53 do_100events();
54 if (PAPI_read_counters(values, num_hwcntrs) != PAPI_OK)
55 handle_error(1);
56 /* values[0] now equals 100 */
57 do_100events();
58 if (PAPI_accum_counters(values, num_hwcntrs) != PAPI_OK)
59 handle_error(1);
60 /* values[0] now equals 200 */
61 values[0] = -100;
62 do_100events();
63 if (PAPI_accum_counters(values, num_hwcntrs) != PAPI_OK)
64 handle_error(1);
65 /* values[0] now equals 0 */
66
67
69 These functions have no known bugs.
70
71
73 PAPI_start_counters(3), PAPI_set_opt(3), PAPI(3),PAPIF(3)
74
75
76
77PAPI Programmer's Reference September, 2004 PAPI_read_counters(3)