---
name: "PAPI_enum_cmp_event"
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_enum_cmp_event"
---

# PAPI\_enum\_cmp\_event(3)

Enumerate PAPI preset or native events for a given component.

## NAME

PAPI\_enum\_cmp\_event - Enumerate PAPI preset or native events for a given component.

## SYNOPSIS

## Detailed Description

**C Interface:**

\#include \<**papi.h**\> \
 int **PAPI\_enum\_cmp\_event( int \*EventCode, int  modifier, int cidx )**;

Given an event code, **PAPI\_enum\_event** replaces the event code with the next available event.

The modifier argument affects which events are returned. For all platforms and event types, a value of PAPI\_ENUM\_ALL (zero) directs the function to return all possible events. \
\
  For native events, the effect of the modifier argument may be different on each platform. See the discussion below for platform-specific definitions.

**Parameters**

*\*EventCode* A defined preset or native event such as PAPI\_TOT\_INS. \
 *modifier* Modifies the search logic. See below for full list. For native events, each platform behaves differently. See platform-specific documentation for details.\
 *cidx* Specifies the component to search in

**Return values**

*PAPI\_ENOEVNT* The next requested PAPI preset or native event is not available on the underlying hardware.

**Examples:**

```
// Scan for all supported native events on the first component
printf( "Name\t\t\t       Code\t   Description\n" );
do {
    retval = PAPI_get_event_info( i, &info );
    if ( retval == PAPI_OK ) {
    printf( "%-30s %#-10x\n%s\n", info.symbol, info.event_code, info.long_descr );
    }
} while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_ALL, 0 ) == PAPI_OK );
```

```
@par Generic Modifiers
```

 The following values are implemented for preset events

- •

  PAPI\_ENUM\_EVENTS -- Enumerate all (default)

- •

  PAPI\_ENUM\_FIRST -- Enumerate first event (preset or native) preset/native chosen based on type of EventCode

```
@par Native Modifiers
```

 The following values are implemented for native events

- •

  PAPI\_NTV\_ENUM\_UMASKS -- Given an event, iterate through possible umasks one at a time

- •

  PAPI\_NTV\_ENUM\_UMASK\_COMBOS -- Given an event, iterate through all possible combinations of umasks. This is not implemented on libpfm4.

**Preset Modifiers**

The following values are implemented for preset events

- •

  PAPI\_PRESET\_ENUM\_AVAIL -- enumerate only available presets

- •

  PAPI\_PRESET\_ENUM\_MSC -- Miscellaneous preset events

- •

  PAPI\_PRESET\_ENUM\_INS -- Instruction related preset events

- •

  PAPI\_PRESET\_ENUM\_IDL -- Stalled or Idle preset events

- •

  PAPI\_PRESET\_ENUM\_BR -- Branch related preset events

- •

  PAPI\_PRESET\_ENUM\_CND -- Conditional preset events

- •

  PAPI\_PRESET\_ENUM\_MEM -- Memory related preset events

- •

  PAPI\_PRESET\_ENUM\_CACH -- Cache related preset events

- •

  PAPI\_PRESET\_ENUM\_L1 -- L1 cache related preset events

- •

  PAPI\_PRESET\_ENUM\_L2 -- L2 cache related preset events

- •

  PAPI\_PRESET\_ENUM\_L3 -- L3 cache related preset events

- •

  PAPI\_PRESET\_ENUM\_TLB -- Translation Lookaside Buffer events

- •

  PAPI\_PRESET\_ENUM\_FP -- Floating Point related preset events

**ITANIUM Modifiers**

The following values are implemented for modifier on Itanium:

- •

  PAPI\_NTV\_ENUM\_IARR - Enumerate IAR (instruction address ranging) events

- •

  PAPI\_NTV\_ENUM\_DARR - Enumerate DAR (data address ranging) events

- •

  PAPI\_NTV\_ENUM\_OPCM - Enumerate OPC (opcode matching) events

- •

  PAPI\_NTV\_ENUM\_IEAR - Enumerate IEAR (instr event address register) events

- •

  PAPI\_NTV\_ENUM\_DEAR - Enumerate DEAR (data event address register) events

**POWER Modifiers**

The following values are implemented for POWER

- •

  PAPI\_NTV\_ENUM\_GROUPS - Enumerate groups to which an event belongs

**See also**

PAPI \
 PAPIF \
\
  **PAPI\_enum\_event** \
 **PAPI\_get\_event\_info** \
 **PAPI\_event\_name\_to\_code** \
 PAPI\_preset \
 PAPI\_native

## Author

Generated automatically by Doxygen for PAPI from the source code.
