---
name: "pmSortInstances"
section: "3"
platform: "linux"
package: "pcp"
version: "7.2.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/pmSortInstances"
---

# pmSortInstances(3)

sort performance metric values on instance identifier

## NAME

**pmSortInstances** - sort performance metric values on instance identifier

## C SYNOPSIS

**#include \<pcp/pmapi.h\>**

**void pmSortInstances(pmResult \****result***);**

**cc ... -lpcp**

## DESCRIPTION

The routine **pmSortInstances** may be used to guarantee that for each performance metric in the *result* from [**pmFetch**(3)](/pmFetch/3.md) the instances are in ascending instance identifier sequence.

This is useful when computing rates from two consecutive samples.

## COMPATIBILITY

Prior to PCP 7.0 the *timestamp* field in the `pmResult` struct was a `struct timeval`. To support PMAPI transition, the old interface and semantics can be used if applications are recompiled with **-DPMAPI\_VERSION=2**.

For a time in PCP 6.x there was a routine with the same semantics as the current **pmSortInstances** called **pmSortHighResInstances**, and a struct with the same definition as the current `pmResult` struct called `pmResultHighRes`, although both are now deprecated and compile-time support for **pmSortHighResInstances** and `pmResultHighRes` will be removed in a future release.

## SEE ALSO

[**PMAPI**(3)](/PMAPI/3.md) and [**pmFetch**(3)](/pmFetch/3.md).
