---
name: "PAPI_set_debug"
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_set_debug"
---

# PAPI\_set\_debug(3)

Set the current debug level for error output from PAPI.

## NAME

PAPI\_set\_debug - Set the current debug level for error output from PAPI.

## SYNOPSIS

## Detailed Description

**C Prototype:**

\#include \<**papi.h**\> \
\
  int **PAPI\_set\_debug( int level )**;

**Parameters**

*level* one of the constants shown in the table below and defined in the **papi.h** header file. \
\
  The possible debug levels for debugging are shown below.

- •

  PAPI\_QUIET Do not print anything, just return the error code

- •

  PAPI\_VERB\_ECONT Print error message and continue

- •

  PAPI\_VERB\_ESTOP Print error message and exit \

**Return values**

*PAPI\_OK* \
 *PAPI\_EINVAL* The debug level is invalid. \

 The current debug level is used by both the internal error and debug message handler subroutines. \
\
  The debug handler is only used if the library was compiled with -DDEBUG. \
\
  The debug handler is called when there is an error upon a call to the PAPI API.\
\
  The error handler is always active and its behavior cannot be modified except for whether or not it prints anything.

The default PAPI debug handler prints out messages in the following form: \
\
  PAPI Error: Error Code code, symbol, description

If the error was caused from a system call and the return code is PAPI\_ESYS, the message will have a colon space and the error string as reported by strerror() appended to the end.

The PAPI error handler prints out messages in the following form: \
\
  PAPI Error: message. \

**Note**

This is the ONLY function that may be called BEFORE **PAPI\_library\_init()**. \

**Example:**

```
int ret;
ret = PAPI_set_debug(PAPI_VERB_ECONT);
if ( ret != PAPI_OK ) handle_error();
```

**See also**

**PAPI\_library\_init**

**PAPI\_get\_opt**

**PAPI\_set\_opt**

## Author

Generated automatically by Doxygen for PAPI from the source code.
