---
name: "PAPI_get_opt"
section: "3"
platform: "linux"
package: "libpapi-dev"
version: "7.1.0-5+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/PAPI_get_opt"
---

# PAPI\_get\_opt(3)

Get PAPI library or event set options.

## NAME

PAPI\_get\_opt - Get PAPI library or event set options.

## SYNOPSIS

## Detailed Description

**C Interface:**

\#include \<**papi.h**\> \
\
  int **PAPI\_get\_opt(  int option, PAPI\_option\_t \* ptr )**;

**Parameters**

*option* Defines the option to get. Possible values are briefly described in the table below.\
 *ptr* Pointer to a structure determined by the selected option. See **PAPI\_option\_t** for a description of possible structures.

**Return values**

*PAPI\_OK* \
 *PAPI\_EINVAL* The specified option or parameter is invalid. \
 *PAPI\_ENOEVST* The EventSet specified does not exist. \
 *PAPI\_ECMP* The option is not implemented for the current component. \
 *PAPI\_ENOINIT* specified option requires PAPI to be initialized first.

**PAPI\_get\_opt()** queries the options of the PAPI library or a specific event set created by **PAPI\_create\_eventset**. Some options may require that the eventset be bound to a component before they can execute successfully. This can be done either by adding an event or by explicitly calling **PAPI\_assign\_eventset\_component**.

Ptr is a pointer to the **PAPI\_option\_t** structure, which is actually a union of different structures for different options. Not all options require or return information in these structures. Each returns different values in the structure. Some options require a component index to be provided. These options are handled explicitly by the **PAPI\_get\_cmp\_opt()** call.

**Note**

Some options, such as PAPI\_DOMAIN and PAPI\_MULTIPLEX are also available as separate entry points in both C and Fortran.

The reader is encouraged to peruse the ctests code in the PAPI distribution for examples of usage of **PAPI\_set\_opt**.

**Possible values for the PAPI\_get\_opt option parameter**

OPTION          DEFINITION PAPI\_DEFDOM     Get default counting domain for newly created event sets. Requires a component index. PAPI\_DEFGRN     Get default counting granularity. Requires a component index. PAPI\_DEBUG      Get the PAPI debug state and the debug handler. The debug state is specified in ptr-\>debug.level. The debug handler is specified in ptr-\>debug.handler. \
                 For further information regarding debug states and the behavior of the handler, see PAPI\_set\_debug. PAPI\_MULTIPLEX  Get current multiplexing state for specified EventSet. PAPI\_DEF\_ITIMER Get the type of itimer used in software multiplexing, overflowing and profiling. PAPI\_DEF\_MPX\_NS Get the sampling time slice in nanoseconds for multiplexing and overflow. PAPI\_DEF\_ITIMER\_NS  See PAPI\_DEF\_MPX\_NS. PAPI\_ATTACH     Get thread or process id to which event set is attached. Returns TRUE if currently attached. PAPI\_CPU\_ATTACH Get ptr-\>cpu.cpu\_num and Attach state for EventSet specified in ptr-\>cpu.eventset. PAPI\_DETACH     Get thread or process id to which event set is attached. Returns TRUE if currently attached. PAPI\_DOMAIN     Get domain for EventSet specified in ptr-\>domain.eventset. Will error if eventset is not bound to a component. PAPI\_GRANUL     Get granularity for EventSet specified in ptr-\>granularity.eventset. Will error if eventset is not bound to a component. PAPI\_INHERIT        Get current inheritance state for specified EventSet. PAPI\_PRELOAD        Get LD\_PRELOAD environment equivalent. PAPI\_CLOCKRATE  Get clockrate in MHz. PAPI\_MAX\_CPUS   Get number of CPUs. PAPI\_EXEINFO        Get Executable addresses for text/data/bss. PAPI\_HWINFO     Get information about the hardware. PAPI\_LIB\_VERSION    Get the full PAPI version of the library. This does not require PAPI to be initialized first. PAPI\_MAX\_HWCTRS Get number of counters. Requires a component index. PAPI\_MAX\_MPX\_CTRS   Get maximum number of multiplexing counters. Requires a component index. PAPI\_SHLIBINFO  Get shared library information used by the program. PAPI\_COMPONENTINFO  Get the PAPI features the specified component supports. Requires a component index.

**See also**

**PAPI\_get\_multiplex**

**PAPI\_get\_cmp\_opt**

**PAPI\_set\_opt**

**PAPI\_option\_t**

## Author

Generated automatically by Doxygen for PAPI from the source code.
