PMPARSETIMEWINDOW(3)
β¨ PMPARSETIMEWINDOW(3) β¨
okay bestie, welcome to pmParseTimeWindow from the Library Functions Manual β yes it's a whole libpcp moment and we're gonna make it make sense π
π NAME π
pmParseTimeWindow β literally just here to parse time window command line arguments for you, no cap π«Ά
π C SYNOPSIS π
#include <pcp/pmapi.h>
int pmParseTimeWindow(const char *swStart, const char *swEnd,
const char *swAlign, const char *swOffset,
const struct timespec *logStart,
const struct timespec *logEnd,
struct timespec *rsltStart,
struct timespec *rsltEnd,
struct timespec *rsltOffset, char **errMsg);
cc ... -lpcp
πΈ DESCRIPTION πΈ
so pmParseTimeWindow is designed to encapsulate the interpretation of the -S, -T, -A and -O command line options that Performance Co-Pilot (PCP) applications use to define a time window of interest. iconic behavior honestly π
that time window is defined by a start time and an end time, and it constrains the time interval during which the PCP application will retrieve and display performance metrics.
now, if the -O and -A options aren't there to specify an initial sample time origin and time alignment (more on those below, keep reading bestie), then the PCP application will retrieve the first sample at the start of the time window. periodt.
the syntax and meaning of all the various argument formats for these options is described over in PCPIntro(1), so go check that out if you need the deets π
π¦ USAGE π¦
pmParseTimeWindow expects to be called like this:
- the argument of the
-Soption goes in asswStart - the argument of the
-Toption goes in asswEnd - the argument of the
-Aoption goes in asswAlign - the argument of the
-Ooption goes in asswOffset
any or all of these parameters can be NULL, which is how you say "yeah that command line option wasn't there, bestie" π
if your application is using a set of PCP archives as the source of performance metrics, you also need to supply:
- the time of the first archive entry as
logStart - the time of the last archive entry as
logEnd
wanna know how to get those values? pmGetArchiveLabel(3) and pmGetArchiveEnd(3) have you covered π
if the application is manipulating multiple concurrent archives, then the caller has to resolve how the default time window is defined. (the union of the time intervals in all archives is a likely interpretation, just saying π)
if the application is using a live feed of performance data:
logStartshould be the current time (but it could be aligned on the next second for example, flexible queen π )logEndshould have itstv_seccomponent set toPM_MAX_TIME_T
the rsltStart, rsltEnd and rsltOffset structures must be allocated before calling pmParseTimeWindow. like, allocated first, always, no exceptions π¨
you also need to set the current PCP reporting time zone so it correctly reflects the -z and -Z command line parameters, and you gotta do that before calling these routines. pmUseZone(3) and friends have the info on how that's done π
π₯ DIAGNOSTICS π₯
if the conversion is successful, pmParseTimeWindow returns 1 and fills in rsltStart, rsltEnd and rsltOffset with the start, end, and offset times for the time window defined by the input parameters. and the errMsg parameter? not changed when pmParseTimeWindow returns 1. untouched, unbothered, living its life β¨
if the conversion is successful but the requested alignment could not be performed (e.g. the set of PCP archives is too short β tragic π) then the alignment is ignored, rsltStart, rsltEnd and rsltOffset are still filled in, and pmParseTimeWindow returns 0. in this case, errMsg will point to a warning message in a dynamically allocated buffer.
π«Ά bestie reminder: the caller is responsible for releasing that buffer by calling free(3).
if the argument strings could not be parsed, pmParseTimeWindow returns -1. in this case, errMsg will point to an error message in a dynamically allocated buffer.
π same deal: the caller is responsible for releasing that buffer by calling free(3).
π COMPATIBILITY π
prior to PCP 7.0 and libpcp.so.4, the logStart, logEnd, rsltStart, rsltEnd and rsltOffset arguments were struct timeval. yes, really, we've come so far π§
to support the PMAPI transition, the old interface and semantics can still be used if applications are linked with libpcp.so.3 or recompiled with -DPMAPI_VERSION=2.
and for a time in PCP 6.x there was a routine with the same semantics as the current pmParseTimeWindow called pmParseHighResTimeWindow β although this is now deprecated, and compile-time support for pmParseHighResTimeWindow will be removed in a future release. so like, don't get attached, it's giving legacy π₯²
β SEE ALSO β
free(3), PMAPI(3), pmGetArchiveEnd(3), pmGetArchiveLabel(3), pmNewContextZone(3), pmNewZone(3), pmParseInterval(3) and pmUseZone(3).
and that's the whole page, bestie!! this was Performance Co-Pilot β PCP β dropping PMPARSETIMEWINDOW(3) for you π stay parsed, stay aligned, and go free your buffers πβ¨
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: libpcp4-dev 7.1.1-1
- ubuntu stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2016,2022 Red Hat
- Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms