---
name: "PAPI_query_named_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_query_named_event"
---

# PAPI\_query\_named\_event(3)

Query if a named PAPI event exists.

## NAME

PAPI\_query\_named\_event - Query if a named PAPI event exists.

## SYNOPSIS

## Detailed Description

**C Interface:**

\#include \<**papi.h**\> \
 int **PAPI\_query\_named\_event(const char \*EventName)**;

**PAPI\_query\_named\_event()** asks the PAPI library if the PAPI named event can be counted on this architecture. If the event CAN be counted, the function returns PAPI\_OK. If the event CANNOT be counted, the function returns an error code. This function also can be used to check the syntax of native and user events.

**Parameters**

*EventName* -- a defined event such as PAPI\_TOT\_INS.

**Return values**

*PAPI\_EINVAL* One or more of the arguments is invalid. \
 *PAPI\_ENOEVNT* The PAPI preset is not available on the underlying hardware.

**Examples**

```
int retval;
// Initialize the library
retval = PAPI_library_init(PAPI_VER_CURRENT);
if (retval != PAPI_VER_CURRENT) {
  fprintf(stderr,\"PAPI library init error!\\n\");
  exit(1);
}
if (PAPI_query_named_event("PAPI_TOT_INS") != PAPI_OK) {
  fprintf(stderr,\"No instruction counter? How lame.\\n\");
  exit(1);
}
```

**See also**

**PAPI\_query\_event**

## Author

Generated automatically by Doxygen for PAPI from the source code.
