---
name: "PAPI_num_events"
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_num_events"
---

# PAPI\_num\_events(3)

Return the number of events in an event set.

## NAME

PAPI\_num\_events - Return the number of events in an event set.

## SYNOPSIS

## Detailed Description

**PAPI\_num\_events()** returns the number of preset and/or native events contained in an event set. The event set should be created by **PAPI\_create\_eventset** .

**C Interface:**

\#include \<**papi.h**\> \
 int **PAPI\_num\_events(int  EventSet )**;

**Parameters**

*EventSet* -- an integer handle for a PAPI event set created by **PAPI\_create\_eventset**. \
 *\*count* -- (Fortran only) On output the variable contains the number of events in the event set

**Return values**

*On* success, this function returns the positive number of events in the event set. \
 *PAPI\_EINVAL* The event count is zero; only if code is compiled with debug enabled. \
 *PAPI\_ENOEVST* The EventSet specified does not exist.

**Example**

```
// Count the events in our EventSet
printf(\"%d events found in EventSet.\\n\", PAPI_num_events(EventSet));
```

**See also**

**PAPI\_add\_event**

**PAPI\_create\_eventset**

## Author

Generated automatically by Doxygen for PAPI from the source code.
