1PMGETARCHIVELABEL(3) Library Functions Manual PMGETARCHIVELABEL(3)
2
3
4
6 pmGetArchiveLabel - fetch the label record from a performance metrics
7 archive log
8
10 #include <pcp/pmapi.h>
11
12 int pmGetArchiveLabel(pmLogLabel *lp);
13
14 cc ... -lpcp
15
17 Within the framework of the Performance Co-Pilot (PCP), archive logs of
18 performance metrics values may be accumulated and saved using the pro‐
19 gram pmlogger(1).
20
21 The routine pmGetArchiveLabel may be used to fetch the label record
22 from an archive log that has already been opened using pmNewContext(3),
23 or pmDupContext(3), and thereby associated with the current Performance
24 Metrics Application Programming Interface (PMAPI) context.
25
26 The result returned via the pointer lp is a structure that must be pre-
27 allocated by the caller and has the following format (defined in
28 pmapi.h).
29
30 /*
31 * Label Record at the start of every log file
32 */
33 typedef struct {
34 int ll_magic; /* PM_LOG_MAGIC | log format version no. */
35 pid_t ll_pid; /* PID of logger */
36 struct timeval ll_start;/* start of this log */
37 char ll_hostname[PM_LOG_MAXHOSTLEN]; /* name of collection host */
38 char ll_tz[40]; /* $TZ at collection host */
39 } pmLogLabel;
40
41 For an application, the most useful information from the archive label
42 is likely to be in the fields ll_start, ll_hostname or ll_tz.
43
44 Note that the size of the ll_hostname field is PM_LOG_MAXHOSTLEN (64
45 bytes) which is less than MAXHOSTNAMELEN (see gethostbyname(3)) on some
46 platforms. These semantics are necessary to retain backwards compati‐
47 bility with the PCP archive file format.
48
49 pmGetArchiveLabel returns zero for success.
50
52 Environment variables with the prefix PCP_ are used to parameterize the
53 file and directory names used by PCP. On each installation, the file
54 /etc/pcp.conf contains the local values for these variables. The
55 $PCP_CONF variable may be used to specify an alternative configuration
56 file, as described in pcp.conf(5). Values for these variables may be
57 obtained programmatically using the pmGetConfig(3) function.
58
60 pmlogger(1), PMAPI(3), pmDupContext(3), pmGetConfig(3), pmNewCon‐
61 text(3), pcp.conf(5) and pcp.env(5).
62
64 PM_ERR_NOCONTEXT
65 the current PMAPI context is either invalid, or not associated
66 with an archive log
67
68
69
70Performance Co-Pilot PCP PMGETARCHIVELABEL(3)