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

NAME

6       pmGetArchiveEnd,  pmGetHighResArchiveEnd  -  locate logical end of file
7       for a set of archives
8

C SYNOPSIS

10       #include <pcp/pmapi.h>
11
12       int pmGetArchiveEnd(struct timeval *tp);
13       int pmGetHighResArchiveEnd(struct timespec *tp);
14
15       cc ... -lpcp
16

DESCRIPTION

18       Assuming the current PMAPI context is associated  with  a  set  of  ar‐
19       chives, pmGetArchiveEnd and pmGetHighResArchiveEnd will attempt to find
20       the logical end of file (after the last complete record in the  set  of
21       archives),  and  return the last recorded timestamp via tp.  This time‐
22       stamp may be passed to pmSetMode(3) or pmSetHighResMode(3) to  reliably
23       position the context at the last valid archive record, e.g. in prepara‐
24       tion for subsequent reading in reverse chronological order.
25
26       For archives that are not concurrently being written, the physical  end
27       of file and the logical end of file are co-incident.  However if an ar‐
28       chive is being written by pmlogger(1) at the same time  an  application
29       is  trying  to  read the archive, the logical end of file may be before
30       the physical end of file due to write buffering  that  is  not  aligned
31       with the logical record boundaries.
32
33       pmGetArchiveEnd  and  pmGetHighResArchiveEnd  return an error less than
34       zero if the context is neither valid, nor associated with a set of  ar‐
35       chives,  or the set of archives is seriously corrupted.  Otherwise, the
36       return value is 0 if there has been no change of state since  the  last
37       call, or 1 if the logical end of file has advanced since the last call.
38
39       In the absence of an error, the result returned via tp is well-defined.
40
41       Both  pmGetArchiveEnd and pmGetHighResArchiveEnd preserve the position‐
42       ing state of the archive file prior to this function call.
43

DIAGNOSTICS

45       PM_ERR_NOCONTEXT
46              the current PMAPI context is either invalid, or  not  associated
47              with a set of archives
48
49       PM_ERR_LOGREC
50              the  set  of archives is sufficiently damaged, that not a single
51              valid record can be found
52

PCP ENVIRONMENT

54       Environment variables with the prefix PCP_ are used to parameterize the
55       file  and  directory names used by PCP.  On each installation, the file
56       /etc/pcp.conf contains the  local  values  for  these  variables.   The
57       $PCP_CONF  variable may be used to specify an alternative configuration
58       file, as described in pcp.conf(5).  Values for these variables  may  be
59       obtained programmatically using the pmGetConfig(3) function.
60

SEE ALSO

62       PMAPI(3),  pmFetch(3),  pmFetchArchive(3), pmGetArchiveLabel(3), pmGet‐
63       Config(3), pmGetHighResArchiveLabel(3), pmFetchHighRes(3), pmFetchHigh‐
64       ResArchive(3),   pmSetModeHighRes(3),   pmSetMode(3),  pcp.conf(5)  and
65       pcp.env(5).
66
67
68
69Performance Co-Pilot                  PCP                   PMGETARCHIVEEND(3)
Impressum