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

# [NAME](#NAME)

pfm\_get\_pmu\_info - get PMU information

# [SYNOPSIS](#SYNOPSIS)

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

int pfm_get_pmu_info(pfm_pmu_t pmu, pfm_pmu_info_t *info);

```

# [DESCRIPTION](#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**](#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**](#desc)

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

[**pmu**](#pmu)

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

[**type**](#type)

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

[**PFM\_PMU\_TYPE\_UNKNOWN**](#PFM_PMU_TYPE_UNKNOWN)

The type of the PMU could not be determined.

[**PFM\_PMU\_TYPE\_CORE**](#PFM_PMU_TYPE_CORE)

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

[**PFM\_PMU\_TYPE\_UNCORE**](#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**](#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**](#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**](#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**](#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**](#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**](#max_encoding)

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

[**is\_present**](#is_present)

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

[**is\_dfl**](#is_dfl)

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

# [RETURN](#RETURN)

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

# [ERRORS](#ERRORS)

[**PFMLIB\_ERR\_NOINIT**](#PFMLIB_ERR_NOINIT)

Library has not been initialized properly.

[**PFMLIB\_ERR\_NOTSUPP**](#PFMLIB_ERR_NOTSUPP)

PMU model is not supported by the library.

[**PFMLIB\_ERR\_INVAL**](#PFMLIB_ERR_INVAL)

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

# [SEE ALSO](#SEE_ALSO)

[pfm\_get\_event\_next(3)](/man/os/libpfm/pfm_get_event_next.3)

# [AUTHOR](#AUTHOR)

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

December, 2009

---

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