---
name: "pfm_get_pmu_info"
section: "3"
platform: "linux"
package: "libpfm"
version: "4.14.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/pfm_get_pmu_info"
---

# pfm\_get\_pmu\_info(3)

get PMU information

## NAME

pfm\_get\_pmu\_info - get PMU information

## SYNOPSIS

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

int pfm_get_pmu_info(pfm_pmu_t pmu, pfm_pmu_info_t *info);

```

## DESCRIPTION

This function returns in **info** information about a PMU model designated by its identifier in **pmu**.

The **pfm\_pmu\_info** structure is defined as follows:

```
typedef struct {
        const char              *name;
        const char              *desc;
        pfm_pmu_t               pmu;
        pfm_pmu_type_t          type;
        int                     size;
        int                     nevents;
        int                     first_event;
        int                     max_encoding;
        int                     num_cntrs;
        int                     num_fixed_cntrs;
        struct {
                int             is_present:1;
                int             is_arch_default:1;
                int             is_core:1;
                int             is_uncore:1;
                int             reserved:28;
        };
} pfm_pmu_info_t;
```

The fields of this structure are defined as follows:

- **name**

  This is the symbolic name of the PMU. This name can be used as a prefix in an event string. This is a read-only string.

- **desc**

  This is the description of PMU. This is a read-only string.

- **pmu**

  This is the unique PMU identification code. It is identical to the value passed in **pmu** and it provided only for completeness.

- **type**

  This field contains the type of the PMU. The following types are defined:

  - **PFM\_PMU\_TYPE\_UNKNOWN**

    The type of the PMU could not be determined.

  - **PFM\_PMU\_TYPE\_CORE**

    This field is set to one when the PMU is implemented by the processor core.

  - **PFM\_PMU\_TYPE\_UNCORE**

    This field is set to one when the PMU is implemented on the processor die but at the socket level, i.e., capturing events for all cores.

- **nevents**

  This is the number of available events for this PMU model based on the host processor. It is **only** valid if the **is\_present** field is set to 1. Event identifiers are not guaranteed contiguous. In other words, it is not because **nevents** is equal to 100, that event identifiers go from 0 to 99. The iterator function **pfm\_get\_event\_next()** must be used to go from one identifier to the next.

- **first\_event**

  This field returns the opaque index of the first event for this PMU model. The index can be used with **pfm\_get\_event\_info()** or **pfm\_get\_event\_next()** functions. In case no event is available, this field contains **-1**.

- **num\_cntrs**

  This field contains the number of generic counters supported by the PMU. A counter is generic if it can count more than one event. When it is not possible to determine the number of generic counters, this field contains **-1**.

- **num\_fixed\_cntrs**

  This field contains the number of fixed counters supported by the PMU. A counter is fixed if it hardwired to count only one event. When it is not possible to determine the number of generic counters, this field contains **-1**.

- **size**

  This field contains the size of the struct passed. This field is used to provide for extensibility of the struct without compromising backward compatibility. The value should be set to **sizeof(pfm\_pmu\_info\_t)**. If instead, a value of **0** is specified, the library assumes the struct passed is identical to the first ABI version which size is **PFM\_PMU\_INFO\_ABI0**. Thus, if fields were added after the first ABI, they will not be set by the library. The library does check that bytes beyond what is implemented are zeroes.

- **max\_encoding**

  This field returns the number of event codes returned by **pfm\_get\_event\_encoding()**.

- **is\_present**

  This field is set to one is the PMU model has been detected on the host system.

- **is\_dfl**

  This field is set to one if the PMU is the default PMU for this architecture. Otherwise this field is zero.

## RETURN

If successful, the function returns **PFM\_SUCCESS** and PMU information in **info**, otherwise it returns an error code.

## ERRORS

- **PFMLIB\_ERR\_NOINIT**

  Library has not been initialized properly.

- **PFMLIB\_ERR\_NOTSUPP**

  PMU model is not supported by the library.

- **PFMLIB\_ERR\_INVAL**

  The **pmu** argument is invalid or **info** is **NULL** or **size** is not zero.

## SEE ALSO

[pfm\_get\_event\_next(3)](/pfm_get_event_next/3.md)

## AUTHOR

Stephane Eranian \<eranian@gmail.com\>
