PMGETVERSION(3)
π PMGETVERSION(3) π
okay bestie, welcome to the Library Functions Manual corner of the PCP universe (that's Performance Co-Pilot, section 3, iykyk) β¨ this one's short and sweet and lowkey adorable.
πΈ NAME πΈ
pmGetVersion β fetch installed PCP version number
π C SYNOPSIS π
#include <pcp/pmapi.h>
int pmGetVersion(void);
cc ... -lpcp
β¨ DESCRIPTION β¨
so pmGetVersion hands you back a binary encoding of the PCP version number that's installed locally on your machine. that's it, that's the whole vibe π
and the way you're supposed to use it is in combo with the related macros PM_VERSION(a,b,c) and PM_VERSION_CURRENT, which generate PCP version numbers in that exact same format. so they all speak the same language, no translation needed. there's an example down below, keep scrolling π«Ά
now, the encoding itself? it's giving one byte per part of the version number of the installed PCP package β so that's the major number, the minor number, and the revision number, three bytes, one each. so PCP version 3.10.5 gets encoded as 0x30a05. iconic.
and if you want the version number as a string instead? that's also available from pmGetConfig with the argument PCP_VERSION. different flavor, same energy β¨
fun fact for the history girlies: pmGetVersion was introduced in PCP 3.10.5.
π EXAMPLE π
here's a C fragment that flexes both the compile-time macros and the run-time pmGetVersion function, for an app that should not be built for PCP versions older than 3.10.5 β but after that, there are two alternative implementations, with a newer (faster, sweeter, smaller) variant of the XYZ service that only becomes available in PCP 4.0.0. slay.
#include <pcp/pmapi.h>
#ifdef PM_VERSION_CURRENT
#if PM_VERSION_CURRENT < PM_VERSION(3,10,5)
/* no pmGetVersion() before PCP 3.10.5 */
printf("PCP version 0x%x too old\n", PM_VERSION_CURRENT);
#endif
version = pmGetVersion();
if (version >= PM_VERSION(4,0,0) {
/* V2 of the XYZ service introduced in PCP 4.0.0 */
printf("Using V2 of service XYZ\n")
...
}
else {
printf("Using V1 of service XYZ\n")
...
}
#else
{
char *ver = pmGetConfig("PCP_VERSION");
/* only option is to extract version number from returned string */
...
}
#endif
π SEE ALSO π
PMAPI(3), and pmGetConfig(3).
and that's the whole page, bestie π this little gem lives in the Performance Co-Pilot (PCP) manual, filed under PMGETVERSION(3) β go forth and version-check responsibly π¦
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: libpcp4-dev 7.1.1-1
- ubuntu stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2015, Ken McDonell. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms