# Performance API (PAPI)

## About this Install Guide

|                       |                  |
|-----------------------|------------------|
| Reading time:         | 15 min           |
| Last updated:         | 22 Jun 2026      |
| Author:               | Jason Andrews, Arm [GitHub](https://github.com/jasonrandrews) [LinkedIn](https://linkedin.com/in/jason-andrews-7b05a8) |
| Official docs:        | [View](https://github.com/icl-utk-edu/papi/wiki/Downloading-and-Installing-PAPI) |

This guide shows you how to install and use the tool with the most common configuration. For advanced options and complete reference information, see the official documentation. Some install guides also include optional next steps to help you explore related workflows or integrations.

Performance Application Programming Interface (PAPI) provides a consistent library of functions for accessing performance counters from an application. You can use PAPI in your source code to access performance counters and profile specific sections of your application. PAPI is available as source code on GitHub.

## What should I do before installing PAPI?

This article provides concise instructions to download, build, and install PAPI on Arm Linux distributions.

Confirm you are using an Arm machine by running:

```bash
uname -m
```

The output should be:

```bash
__output__ aarch64
```

If you see a different result, you are not using an Arm computer running 64-bit Linux.

You need `gcc` and `make` to build PAPI. Use the Linux package manager to install the required software packages on your Linux distribution. For Debian based distributions (including Ubuntu) run:

```bash
sudo apt update -y
sudo apt install -y make gcc
```

## How do I download, build, install, and test PAPI?

1. Clone the PAPI repository:

```bash
git clone https://github.com/icl-utk-edu/papi/
```

2. Configure and compile the source code:

```bash
cd papi/src
chmod +x configure
./configure
make
```

3. Install PAPI:

```bash
cd papi/src
sudo make install
```

4. Copy the test program below and paste it into a text file named `papi-test.c`:

```c
#include <papi.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
    // Initialize the PAPI library and print the version
    int ver = PAPI_library_init(PAPI_VER_CURRENT);
    printf("PAPI version is %d.%d\n", PAPI_VERSION_MAJOR(ver), PAPI_VERSION_MINOR(ver));

    exit(0);
}
```

5. Compile and run the application:

```bash
gcc -o papi-test papi-test.c -Wl,-rpath /usr/local/lib -lpapi
./papi-test
```

The output will be similar to:

```bash
__output__ PAPI version is 7.0
```

Your version may be slightly different but that is fine. You are now ready to use PAPI in your own applications.
