Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pmparsemetricspec(3) [centos man page]

PMPARSEMETRICSPEC(3)					     Library Functions Manual					      PMPARSEMETRICSPEC(3)

NAME
pmParseMetricSpec, pmFreeMetricSpec - uniform metric specification parser C SYNOPSIS
#include <pcp/pmapi.h> int pmParseMetricSpec(const char *string, int isarch, char *source, pmMetricSpec **rsltp, char **errmsg); void pmFreeMetricSpec(pmMetricSpec *rslt); cc ... -lpcp DESCRIPTION
pmParseMetricSpec accepts a string specifying the name of a PCP performance metric, and optionally the source (either a hostname or a PCP archive log filename) and instances for that metric. The syntax is described in PCPIntro(1). If neither host nor archive component of the metric specification is provided, the isarch and source arguments are used to fill in the re- turned pmMetricSpec structure. The pmMetricSpec structure that is returned via rsltp represents the parsed string and has the following declaration: typedef struct { int isarch; /* source type: 0 -> live host, 1 -> archive, 2 -> local context */ char *source; /* name of source host or archive */ char *metric; /* name of metric */ int ninst; /* number of instances, 0 -> all */ char *inst[1]; /* array of instance names */ } pmMetricSpec; pmParseMetricSpec returns 0 if the given string was successfully parsed. In this case all the storage allocated by pmParseMetricSpec can be released by a single call to free(3C) using the address returned from pmMetricSpec via rsltp. The convenience macro pmFreeMetricSpec is a thinly disguised wrapper for free(3C). pmParseMetricSpec returns PM_ERR_GENERIC and a dynamically allocated error message string in errmsg, if the given string does not parse. Be sure to free(3C) the error message string in this situation. In the case of an error, rsltp is undefined. In the case of success, errmsg is undefined. If rsltp->ninst is 0, then rsltp->inst[0] is undefined. SEE ALSO
PMAPI(3) and pmLookupName(3). Performance Co-Pilot PCP PMPARSEMETRICSPEC(3)

Check Out this Related Man Page

PMPARSETIME(3)						     Library Functions Manual						    PMPARSETIME(3)

NAME
__pmParseTime - parse time point specification C SYNOPSIS
#include <pcp/pmapi.h> #include <pcp/impl.h> int __pmParseTime(const char *string, struct timeval *logStart, struct timeval *logEnd, struct timeval *rslt, char **errMsg); cc ... -lpcp DESCRIPTION
__pmParseTime is designed to encapsulate the interpretation of a time point specification in command line switches for use by the PCP client tools. This function expects to be called with the time point specification as string. If the tool is running against PCP archive(s), you also need to supply the start time of the first (only) archive as logStart, and the end of the last (only) archive as logEnd. See pmGetArchive- Label(3) and pmGetArchiveEnd(3) for how to obtain values for these parameters. If the tool is running against a live feed of performance data, logStart should be the current time (but could be aligned on the next second for example), while logEnd should have its tv_sec compo- nent set to INT_MAX. The rslt structure must be allocated before calling __pmParseTime. You also need to set the current PCP reporting time zone to correctly reflect the -z and -Z command line parameters before calling __pm- ParseTime. See pmUseZone(3) and friends for information on how this is done. If the conversion is successful, __pmParseTime returns 0, and fills in rslt with the time value defined by the input parameters. If the argument strings could not be parsed, it returns -1 and a dynamically allocated error message string in errMsg. Be sure to free(3C) this error message string. SEE ALSO
PMAPI(3), pmGetArchiveEnd(3), pmGetArchiveLabel(3), pmNewContextZone(3), pmNewZone(3), pmParseInterval(3), pmParseTimeWindow(3), pmUse- Zone(3), __pmConvertTime(3) and __pmParseCtime(3). Performance Co-Pilot PCP PMPARSETIME(3)
Man Page