---
name: "libpfm_core"
section: "3"
platform: "linux"
package: "libpfm3-3.2-dev"
version: "3.2.070507-1.1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/libpfm_core"
---

# libpfm\_core(3)

support for Intel Core processor family

## NAME

libpfm\_core - support for Intel Core processor family

## SYNOPSIS

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

```

## DESCRIPTION

The libpfm library provides full support for the Intel Core processor family, including the Core 2 Duo series. The interface is defined in **pfmlib\_core.h**. It consists of a set of functions and structures which describe and allow access to the Intel Core processors specific PMU features.

When Intel Core processor specific features are needed to support a measurement, their descriptions must be passed as model-specific input arguments to the **pfm\_dispatch\_events** call. The Intel Core\
  processors specific input arguments are described in the **pfmlib\_core\_input\_param\_t** structure and the output parameters in **pfmlib\_core\_output\_param\_t**. They are defined as follows:

```
typedef struct {
	unsigned int	cnt_mask;
	unsigned int	flags;
} pfmlib_core_counter_t;
typedef struct {
	unsigned int pebs_used;
} pfmlib_core_pebs_t;
typedef struct {
	pfmlib_core_counter_t	pfp_core_counters[PMU_CORE_NUM_COUNTERS];
	pfmlib_core_pebs_t	pfp_core_pebs;
	uint64_t		reserved[4];
} pfmlib_core_input_param_t;
typedef struct {
	uint64_t	reserved[8];
} pfmlib_core_output_param_t;
```

The Intel Core processor provides a few additional per-event features for  counters: thresholding, inversion, edge detection. They can be set using the  **pfp\_core\_counters** data structure for each event.  The **flags** field can be initialized as follows:

- **PFMLIB\_CORE\_SEL\_INV**

  Inverse the results of the **cnt\_mask** comparison when set

- **PFMLIB\_CORE\_SEL\_EDGE**

  Enables edge detection of events.

The **cnt\_mask** field contains is used to set the event threshold. The value of the counter is incremented each time the number of occurrences per cycle of the event is greater or equal to the value of the field. When zero all occurrences are counted.

## Support for Precise-Event Based Sampling (PEBS)

The library can be used to setup the PMC registers when using PEBS. In this case, the **pfp\_core\_pebs** structure must be used and the **pebs\_used** field must be set to 1. When using PEBS, it is not possible to use more than one event.

## Support for Intel Core 2 Duo processors

The Intel Core 2 Duo processors are based on the Intel Core micro-architecture. They implement the Intel architectural PMU and some extensions such as PEBS. They support all the architectural events and a lot more Core 2 specific events. The library auto-detects the processor and provides access to Core 2 events whenever possible.

## ERRORS

Refer to the description of **pfm\_dispatch\_events()** for errors.

## SEE ALSO

[pfm\_dispatch\_events(3)](/pfm_dispatch_events/3.md) and set of examples shipped with the library

## AUTHOR

Stephane Eranian \<eranian@hpl.hp.com\>
