---
name: "libpfm_x86_64"
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_x86_64"
---

# libpfm\_x86\_64(3)

support for AMD X86-64 processor family

## NAME

libpfm\_i386\_p6 - support for AMD X86-64 processor family

## SYNOPSIS

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

```

## DESCRIPTION

The libpfm library provides full support for the X86-64 processor family when running in 64-bit mode. The interface is defined in **pfmlib\_gen\_x86\_64.h**. It consists of a set of functions and structures which describe and allow access to the X86-64 specific PMU features. Note that it does not support Intel EM64T processors.

When X86-64 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 X86-64 processors specific  input arguments are described in the **pfmlib\_gen\_x86\_64\_input\_param\_t** structure and the output parameters in **pfmlib\_gen\_x86\_64\_output\_param\_t**. They are defined as follows:

```
typedef struct {
	unsigned int	cnt_mask;
	unsigned int	flags;
} pfmlib_gen_x86_64_counter_t;
typedef struct {
	pfmlib_gen_x86_64_counter_t	pfp_gen_x86_64_counters[PMU_GEN_X86_64_NUM_COUNTERS];
	uint64_t			reserved[4];
} pfmlib_gen_x86_64_input_param_t;
typedef struct {
	uint64_t	reserved[8];
} pfmlib_gen_x86_64_output_param_t;
```

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

- **PFMLIB\_GEN\_X86\_64\_SEL\_INV**

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

- **PFMLIB\_GEN\_X86\_64\_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.

## 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\>
