1PMPARSETIMEWINDOW(3) Library Functions Manual PMPARSETIMEWINDOW(3)
2
3
4
6 pmParseTimeWindow, pmParseHighResTimeWindow - parse time window command
7 line arguments
8
10 #include <pcp/pmapi.h>
11
12 int pmParseTimeWindow(const char *swStart, const char *swEnd,
13 const char *swAlign, const char *swOffset,
14 const struct timeval *logStart, const struct timeval *logEnd,
15 struct timeval *rsltStart, struct timeval *rsltEnd,
16 struct timeval *rsltOffset, char **errMsg);
17 int pmParseHighResTimeWindow(const char *swStart, const char *swEnd,
18 const char *swAlign, const char *swOffset,
19 const struct timespec *logStart, const struct timespec *logEnd,
20 struct timespec *rsltStart, struct timespec *rsltEnd,
21 struct timespec *rsltOffset, char **errMsg);
22
23 cc ... -lpcp
24
26 pmParseTimeWindow and pmParseHighResTimeWindow are designed to encapsu‐
27 late the interpretation of the -S, -T, -A and -O command line options
28 used by Performance Co-Pilot (PCP) applications to define a time window
29 of interest. The time window is defined by a start time and an end
30 time that constrains the time interval during which the PCP application
31 will retrieve and display performance metrics. In the absence of the
32 -O and -A options to specify an initial sample time origin and time
33 alignment (see below), the PCP application will retrieve the first sam‐
34 ple at the start of the time window.
35
36 The syntax and meaning of the various argument formats for these op‐
37 tions is described in PCPIntro(1).
38
40 pmParseTimeWindow and pmParseHighResTimeWindow expect to be called with
41 the argument of the -S option as swStart, the argument of the -T option
42 as swEnd, the argument of the -A option as swAlign, and the argument of
43 the -O option as swOffset. Any or all of these parameters may be NULL
44 to indicate that the corresponding command line option was not present.
45
46 If the application is using a set of PCP archives as the source of per‐
47 formance metrics, you also need to supply the time of the first archive
48 entry as logStart, and the time of the last archive entry as logEnd.
49 See pmGetArchiveLabel(3) and pmGetArchiveEnd(3) for how to obtain val‐
50 ues for these times.
51
52 If the application is manipulating multiple concurrent archives, then
53 the caller must resolve how the default time window is to be defined
54 (the union of the time intervals in all archives is a likely interpre‐
55 tation).
56
57 If the application is using a live feed of performance data, logStart
58 should be the current time (but could be aligned on the next second for
59 example), while logEnd should have its tv_sec component set to
60 PM_MAX_TIME_T.
61
62 The rsltStart, rsltEnd and rsltOffset structures must be allocated be‐
63 fore calling pmParseTimeWindow or pmParseTimeHighResWindow.
64
65 You also need to set the current PCP reporting time zone to correctly
66 reflect the -z and -Z command line parameters before calling these rou‐
67 tines. See pmUseZone(3) and friends for information on how this is
68 done.
69
71 If the conversion is successful, pmParseTimeWindow and pmParseHighRes‐
72 TimeWindow return 1 and fill in rsltStart, rsltEnd and rsltOffset with
73 the start, end, and offset times for the time window defined by the in‐
74 put parameters. The errMsg parameter is not changed when either pm‐
75 ParseTimeWindow or pmParseHighResTimeWindow returns 1.
76
77 If the conversion is successful, but the requested alignment could not
78 be performed (e.g. the set of PCP archives is too short) the alignment
79 is ignored, rsltStart, rsltEnd and rsltOffset are filled in and pm‐
80 ParseTimeWindow and pmParseHighResTimeWindow return 0. In this case,
81 errMsg will point to a warning message in a dynamically allocated buf‐
82 fer. The caller is responsible for releasing the buffer by calling
83 free(3).
84
85 If the argument strings could not be parsed, pmParseTimeWindow and pm‐
86 ParseHighResTimeWindow return -1. In this case, errMsg will point to
87 an error message in a dynamically allocated buffer. The caller is re‐
88 sponsible for releasing the buffer by calling free(3).
89
91 free(3), PMAPI(3), pmGetArchiveEnd(3), pmGetArchiveLabel(3), pmNewCon‐
92 textZone(3), pmNewZone(3), pmParseInterval(3) and pmUseZone(3).
93
94
95
96Performance Co-Pilot PCP PMPARSETIMEWINDOW(3)