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

NAME

6       pmParseMetricSpec,  pmFreeMetricSpec  -  uniform  metric  specification
7       parser
8

C SYNOPSIS

10       #include <pcp/pmapi.h>
11
12       int pmParseMetricSpec(const char *string,  int  isarch,  char  *source,
13       pmMetricSpec **rsltp, char **errmsg)
14
15       void pmFreeMetricSpec(pmMetricSpec *rslt)
16
17       cc ... -lpcp
18

DESCRIPTION

20       pmParseMetricSpec accepts a string specifying the name of a PCP perfor‐
21       mance metric, and optionally the source (either a hostname or a PCP ar‐
22       chive  log  filename)  and  instances  for  that metric.  The syntax is
23       described in PCPIntro(1).
24
25       If neither host nor archive component of the  metric  specification  is
26       provided,  the  isarch  and  source  arguments  are used to fill in the
27       returned pmMetricSpec structure.
28
29       The pmMetricSpec structure that is returned via  rsltp  represents  the
30       parsed string and has the following declaration:
31
32           typedef struct {
33               int     isarch;      /* source type: 0 -> live host, 1 -> archive, 2 -> local context */
34               char    *source;     /* name of source host or archive */
35               char    *metric;     /* name of metric */
36               int     ninst;       /* number of instances, 0 -> all */
37               char    *inst[1];    /* array of instance names */
38           } pmMetricSpec;
39
40       pmParseMetricSpec  returns  0  if  the  given  string  was successfully
41       parsed.  In this case all the storage  allocated  by  pmParseMetricSpec
42       can be released by a single call to free(3C) using the address returned
43       from pmMetricSpec via rsltp.  The convenience macro pmFreeMetricSpec is
44       a thinly disguised wrapper for free(3C).
45
46       pmParseMetricSpec  returns  PM_ERR_GENERIC  and a dynamically allocated
47       error message string in errmsg, if the given string does not parse.  Be
48       sure to free(3C) the error message string in this situation.
49
50       In  the  case of an error, rsltp is undefined.  In the case of success,
51       errmsg is undefined.  If rsltp->ninst  is  0,  then  rsltp->inst[0]  is
52       undefined.
53

SEE ALSO

55       PMAPI(3) and pmLookupName(3).
56
57
58
59Performance Co-Pilot                  SGI                 PMPARSEMETRICSPEC(3)
Impressum