All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
PAPI_num_counters Class Reference

Get the number of hardware counters available on the system. More...

Detailed Description

@par C Interface:
\#include <papi.h> @n
int PAPI_num_counters( void );
Initializes the library to PAPI_HIGH_LEVEL_INITED if necessary.
Return values
PAPI_EINVALpapi.h is different from the version used to compile the PAPI library.
PAPI_ENOMEMInsufficient memory to complete the operation.
PAPI_ESYSA system or C library call failed inside PAPI, see the errno variable.
* int num_hwcntrs;
* // The installation does not support PAPI
* if ((num_hwcntrs = PAPI_num_counters()) < 0 )
* handle_error(1);
* // The installation supports PAPI, but has no counters
* if ((num_hwcntrs = PAPI_num_counters()) == 0 )
* fprintf(stderr,"Info:: This machine does not provide hardware counters.\n");

PAPI_num_counters() returns the optimal length of the values array for the high level functions. This value corresponds to the number of hardware counters supported by the current CPU component.

This function only works for the CPU component. To determine the number of counters on another component, use the low level PAPI_num_cmp_hwctrs().

The documentation for this class was generated from the following file: