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

# pmPrintValue(3)

print a performance metric value

## NAME

**pmPrintValue** - print a performance metric value

## C SYNOPSIS

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

**void pmPrintValue(FILE \****f***,** **int** *valfmt***,** **int** *type***,** **const pmValue \****val***,** **int** *minwidth***);**

**cc ... -lpcp**

## DESCRIPTION

The value of a single performance metric (as identified by *val*) is printed on the standard I/O stream identified by *f*.

The value of the performance metric is interpreted according to the format of *val* as defined by *valfmt* (from a *pmValueSet* within a *pmResult* structure; see [**pmFetch**(3)](/pmFetch/3.md)) and the generic description of the metrics type passed in via *type*.

The value for *type* is typically extracted from a *pmDesc* structure, following a call to [**pmLookupDesc**(3)](/pmLookupDesc/3.md) for a particular performance metric.

The output will be optionally padded to be at least *minwidth* characters wide.

**pmPrintValue** is most useful for displaying values of performance metrics from [**pmFetch**(3)](/pmFetch/3.md) (which returns a set of *valfmt* and *val* pairs for each requested metric), based upon the metrics type as returned from [**pmLookupDesc**(3)](/pmLookupDesc/3.md).

## ENVIRONMENT

Output of string metric values can be further controlled using **PCP\_SQUASH\_NEWLINES**. When set in the environment of the calling process, and the *type* is set to PM\_TYPE\_STRING or PM\_TYPE\_AGGREGATE, then the output value is guaranteed to be free of embedded newline characters. If the given value contained such characters, they will have been replaced by a space before being printed.

For floating point values (type PM\_TYPE\_FLOAT), the default precision is 8 digits.  Setting **PCP\_FLOAT\_PRECISION** in the environment to some integer value other than 8 will change the number of digits reported, which may be useful to avoid the conversion to \`\`scientific notation'' that is done by [**printf**(3)](/printf/3.md) for the **%g** format specifier; acceptable values are ≥ 1 and ≤ 10. Similarly, the environment variable **PCP\_DOUBLE\_PRECISION** can be set to change the precision of double precision floating point values (type PM\_TYPE\_DOUBLE) from the default value of 16; acceptable values are ≥ 1 and ≤ 18.

## SEE ALSO

[**PMAPI**(3)](/PMAPI/3.md), [**pmAtomStr**(3)](/pmAtomStr/3.md), [**pmConvScale**(3)](/pmConvScale/3.md), [**pmExtractValue**(3)](/pmExtractValue/3.md), [**pmFetch**(3)](/pmFetch/3.md), [**pmLookupDesc**(3)](/pmLookupDesc/3.md), [**pmTypeStr**(3)](/pmTypeStr/3.md) and [**pmUnitsStr**(3)](/pmUnitsStr/3.md).
