1PMGETVERSION(3)            Library Functions Manual            PMGETVERSION(3)
2
3
4

NAME

6       pmGetVersion - fetch installed PCP version number
7

C SYNOPSIS

9       #include <pcp/pmapi.h>
10
11       int pmGetVersion(void);
12
13       cc ... -lpcp
14

DESCRIPTION

16       pmGetVersion  returns  a  binary  encoding of the locally installed PCP
17       version number.
18
19       This  may  be   used   in   conjunction   with   the   related   macros
20       PM_VERSION(a,b,c)  and  PM_VERSION_CURRENT  that  generate  PCP version
21       numbers in the same format.  Refer to the example below.
22
23       The encoding uses one byte for each of the parts of the version  number
24       of the installed PCP package, namely the major number, the minor number
25       and the revision number.  So PCP version 3.10.5 is encoded as 0x30a05.
26
27       The string format of the installed PCP package version number  as  also
28       available from pmGetConfig with the argument PCP_VERSION.
29
30       pmGetVersion was introduced in PCP 3.10.5.
31

EXAMPLE

33       The  following C fragment demonstrates the use of both the compile-time
34       macros and the run-time pmGetVersion function for an  application  that
35       should  not be built for PCP versions older than 3.10.5, but after that
36       there  are  two  alternative  implementations  with  a  newer  (faster,
37       sweeter,  smaller)  variant  of  the  XYZ  service  that  only becoming
38       available in PCP 4.0.0.
39
40       #include <pcp/pmapi.h>
41
42       #ifdef PM_VERSION_CURRENT
43       #if PM_VERSION_CURRENT < PM_VERSION(3,10,5)
44           /* no pmGetVersion() before PCP 3.10.5 */
45           printf("PCP version 0x%x too old\n", PM_VERSION_CURRENT);
46       #endif
47           version = pmGetVersion();
48           if (version >= PM_VERSION(4,0,0) {
49            /* V2 of the XYZ service introduced in PCP 4.0.0 */
50            printf("Using V2 of service XYZ\n")
51            ...
52           }
53           else {
54            printf("Using V1 of service XYZ\n")
55            ...
56           }
57       #else
58           {
59            char *ver = pmGetConfig("PCP_VERSION");
60            /* only option is to extract version number from returned string */
61            ...
62           }
63       #endif
64

SEE ALSO

66       PMAPI(3), and pmGetConfig(3).
67
68
69
70Performance Co-Pilot                  PCP                      PMGETVERSION(3)
Impressum