1PAPI_num_counters(3) PAPI PAPI_num_counters(3)
2
3
4
6 PAPI_num_counters - PAPI High Level: return the number of hardware
7 counters available on the system
8
9
11 C Interface
12 #include <papi.h>
13 int PAPI_num_counters(void);
14 Fortran Interface
15 #include fpapi.h
16 PAPIF_num_counters(C_INT number)
17
18
20 PAPI_num_counters() returns the optimal length of the values array for
21 the high level functions. This value corresponds to the number of
22 hardware counters supported by the current substrate. PAPI_num_coun‐
23 ters() initializes the library to PAPI_HIGH_LEVEL_INITED if necessary.
24
25
27 On success, this function returns the number of hardware counters
28 available.
29 On error, a negative error code is returned.
30
31
33 PAPI_EINVAL
34 papi.h is different from the version used to compile the PAPI
35 library.
36
37 PAPI_ENOMEM
38 Insufficient memory to complete the operation.
39
40 PAPI_ESYS
41 A system or C library call failed inside PAPI, see the errno
42 variable.
43
44
46 int num_hwcntrs;
47 /* The installation does not support PAPI */
48 if ((num_hwcntrs = PAPI_num_counters()) < 0 )
49 handle_error(1);
50
51 /* The installation supports PAPI, but has no counters */
52 if ((num_hwcntrs = PAPI_num_counters()) == 0 )
53 fprintf(stderr,"Info:: This machine does not provide hardware counters.0);
54
55
57 If you don't call this function, your application could core dump.
58
59
61 PAPI(3),PAPIF(3)
62
63
64
65PAPI Programmer's Reference September, 2004 PAPI_num_counters(3)