---
name: "pfm_initialize"
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_initialize"
---

# pfm\_initialize(3)

initialize library

## NAME

pfm\_initialize - initialize library

## SYNOPSIS

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

int pfm_initialize(void);

```

## DESCRIPTION

This is the first function that a program **must** call otherwise the library will not operate.  This function probes the underlying hardware looking for valid PMU event tables to activate. Multiple distinct PMU tables may be activated at the same time.

The function must be called only once. If the function is called more than once, it does not execute the initialization multiple times, it simply returns the same value as for the first call. This is **not a reentrant function**. Only one thread at a time can call the function

## RETURN

The function returns whether or not it was successful, i.e., at least one PMU was activated. A return value of **PFMLIB\_SUCCESS** indicates success, otherwise the value is an error code.

## ERRORS

- **PFMLIB\_ERR\_NOTSUPP**

  No PMU was activated.

## AUTHOR

Stephane Eranian \<eranian@gmail.com\>
