LIBPFM(3) Linux Programmer's Manual LIBPFM(3)

# [NAME](#NAME)

pfm\_strerror - return constant string describing error code

# [SYNOPSIS](#SYNOPSIS)

```
#include <perfmon/pfmlib.h>

const char *pfm_strerror(int code);

```

# [DESCRIPTION](#DESCRIPTION)

This function returns a string which describes the libpfm error value in **code**. The string returned by the call is **read-only**.

The function must **only** be used with libpfm calls documented to return specific error codes. The value -1 is not considered a specific error code. Strings and **pfm\_pmu\_t** return values cannot be used with this function. Typically **NULL** is returned in case of error for string values, and **PFM\_PMU\_NONE** is returned for **pfm\_pmu\_t** values.

The function is also not designed to handle OS system call errors, i.e., errno values.

# [RETURN](#RETURN)

The function returns a pointer to the constant string describing the error code. The string is in English. If code is invalid then a default error message is returned.

# [ERRORS](#ERRORS)

If the error code is invalid, then the function returns a pointer to a string which says "unknown error code".

# [AUTHOR](#AUTHOR)

Stephane Eranian &lt;eranian@gmail.com&gt;

September, 2009

---

Document: pfm_strerror(3) from libpfm 4.14.1-r0 (Chainguard OS)
Source: https://git.code.sf.net/p/perfmon2/libpfm4
