1PMPARSETIMEWINDOW(3) Library Functions Manual PMPARSETIMEWINDOW(3)
2
3
4
6 pmParseTimeWindow - parse time window command line arguments
7
9 #include <pcp/pmapi.h>
10
11 int pmParseTimeWindow(const char *swStart, const char *swEnd, const
12 char *swAlign, const char *swOffset, const struct timeval *logStart,
13 const struct timeval *logEnd, struct timeval *rsltStart, struct timeval
14 *rsltEnd, struct timeval *rsltOffset, char **errMsg)
15
16 cc ... -lpcp
17
19 pmParseTimeWindow is designed to encapsulate the interpretation of the
20 -S, -T, -A and -O command line options used by Performance Co-Pilot
21 (PCP) applications to define a time window of interest. The time win‐
22 dow is defined by a start time and an end time that constrains the time
23 interval during which the PCP application will retrieve and display
24 performance metrics. In the absence of the -O and -A options to spec‐
25 ify an initial sample time origin and time alignment (see below), the
26 PCP application will retrieve the first sample at the start of the time
27 window.
28
29 The syntax and meaning of the various argument formats for these
30 options is described in PCPIntro(1).
31
33 pmParseTimeWindow expects to be called with the argument of the -S
34 option as swStart, the argument of the -T option as swEnd, the argument
35 of the -A option as swAlign, and the argument of the -O option as
36 swOffset. Any or all of these parameters may be NULL to indicate that
37 the corresponding command line option was not present.
38
39 If the application is using a PCP archive log as the source of perfor‐
40 mance metrics, you also need to supply the time of the first archive
41 log entry as logStart, and the time of the last archive log entry as
42 logEnd. See pmGetArchiveLabel(3) and pmGetArchiveEnd(3) for how to
43 obtain values for these times.
44
45 If the application is manipulating multiple concurrent archive logs,
46 then the caller must resolve how the default time window is to be
47 defined (the union of the time intervals in all archive logs is a
48 likely interpretation).
49
50 If the application is using a live feed of performance data, logStart
51 should be the current time (but could be aligned on the next second for
52 example), while logEnd should have its tv_sec component set to INT_MAX.
53
54 The rsltStart, rsltEnd and rsltOffset structures must be allocated
55 before calling pmParseTimeWindow.
56
57 You also need to set the current PCP reporting time zone to correctly
58 reflect the -z and -Z command line parameters before calling pmParse‐
59 TimeWindow. See pmUseZone(3) and friends for information on how this
60 is done.
61
63 PMAPI(3), pmGetArchiveEnd(3), pmGetArchiveLabel(3), pmNewCon‐
64 textZone(3), pmNewZone(3), pmParseInterval(3) and pmUseZone(3).
65
67 If the conversion is successful, pmParseTimeWindow returns 1 and fills
68 in rsltStart, rsltEnd and rsltOffset with the start, end, and offset
69 times for the time window defined by the input parameters. The errMsg
70 parameter is not changed when pmParseTimeWindow returns 1.
71
72 If the conversion is successful, but the requested alignment could not
73 be performed (e.g. the PCP archive log is too short) the alignment is
74 ignored, rsltStart, rsltEnd and rsltOffset are filled in and pmParse‐
75 TimeWindow returns 0. In this case, errMsg will point to a warning
76 message in an internal static buffer. This buffer should not be freed.
77
78 If the argument strings could not be parsed, pmParseTimeWindow returns
79 -1. In this case, errMsg will point to an error message in a static
80 internal buffer.
81
82
83
84Performance Co-Pilot SGI PMPARSETIMEWINDOW(3)