---
name: "PAPI_assign_eventset_component"
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_assign_eventset_component"
---

# PAPI\_assign\_eventset\_component(3)

Assign a component index to an existing but empty EventSet.

## NAME

PAPI\_assign\_eventset\_component - Assign a component index to an existing but empty EventSet.

## SYNOPSIS

## Detailed Description

**C Interface:**

\#include \<**papi.h**\> \
 **PAPI\_assign\_eventset\_component( int  EventSet, int  cidx )**;

**Parameters**

*EventSet* An integer identifier for an existing EventSet. \
 *cidx* An integer identifier for a component. By convention, component 0 is always the cpu component.

**Return values**

*PAPI\_ENOCMP* The argument cidx is not a valid component. \
 *PAPI\_ENOEVST* The EventSet doesn't exist. \
 *PAPI\_ENOMEM* Insufficient memory to complete the operation.

**PAPI\_assign\_eventset\_component** assigns a specific component index, as specified by cidx, to a new EventSet identified by EventSet, as obtained from **PAPI\_create\_eventset**. EventSets are ordinarily automatically bound to components when the first event is added. This routine is useful to explicitly bind an EventSet to a component before setting component related options.

**Examples:**

```
int EventSet = PAPI_NULL;
if ( PAPI_create_eventset( &EventSet ) != PAPI_OK )
handle_error( 1 );
// Bind our EventSet to the cpu component
if ( PAPI_assign_eventset_component( EventSet, 0 ) != PAPI_OK )
handle_error( 1 );
// Convert our EventSet to multiplexing
if ( PAPI_set_multiplex( EventSet ) != PAPI_OK )
handle_error( 1 );
```

**See also**

**PAPI\_set\_opt** \
 **PAPI\_create\_eventset** \
 **PAPI\_add\_events** \
 **PAPI\_set\_multiplex**

## Author

Generated automatically by Doxygen for PAPI from the source code.
