1MMV_STATS_INIT(3) Library Functions Manual MMV_STATS_INIT(3)
2
3
4
6 mmv_stats_init - create and initialize Memory Mapped Value file
7
9 #include <pcp/pmapi.h> #include <pcp/mmv_stats.h>
10
11 void * mmv_stats_init(const char *name,
12 int cluster, mmv_stats_flags_t flags,
13 const mmv_metric_t *stats, int nstats,
14 mmv_indom_t *indoms, int nindoms);
15
16 cc ... -lpcp_mmv -lpcp
17
19 mmv_stats_init creates and initializes the content of the MMV(4) file.
20
21 The file is created in the $PCP_TMP_DIR/mmv directory, name argument is
22 expected to be just a name of the file, not the full path. The meta‐
23 data content of the file does not change after the file has been cre‐
24 ated.
25
26 The old file is removed unconditionally unless there was an error.
27
28 cluster is the preferred MMV PMDA cluster ID to be used for the metrics
29 originating from this call to mmv_stats_init. The flags provide addi‐
30 tional control over the behaviour of the MMV PMDA - e.g. use of
31 MMV_FLAG_PROCESS will ensure values are only exported when the instru‐
32 mented application is running - this is verified on each request for
33 new values.
34
35 stats is the array of mmv_metric_t elements of length nstats. Each ele‐
36 ment of the array describes one PCP metric.
37
38 typedef struct {
39 char name[MMV_NAMEMAX]; /* Name of the metric */
40 __uint32_t item; /* Item component of PMID */
41 mmv_metric_type_t type; /* Type of the metric */
42 mmv_metric_sem_t semantics; /* Semantics of the metric */
43 pmUnits dimension; /* Dimensions (TIME,SPACE,etc) */
44 __uint32_t indom; /* Instance domain identifier */
45 char *shorttext; /* Optional, one-line help */
46 char *helptext; /* Optional, full help text */
47 } mmv_metric_t;
48
49 If indom is not zero and not PM_INDOM_NULL, then the metric has multi‐
50 ple values and there must be a corresponding indom entry in the indom
51 list (uniquely identified by serial number).
52
53 The stats array cannot contain any elements which have no name - this
54 is considered an error and no metrics will be exported in this case.
55
56 indoms is the array of mmv_indom_t elements of length nindoms. Each
57 element of the array describes one PCP instance domain.
58
59 typedef struct {
60 __int32_t internal;
61 char external[MMV_NAMEMAX];
62 } mmv_instances_t;
63
64 typedef struct {
65 __uint32_t serial; /* Unique serial number */
66 __uint32_t count; /* Number of instances */
67 mmv_instances_t *instances; /* Internal/external IDs */
68 char *shorttext; /* Short help text */
69 char *helptext; /* Long help text */
70 } mmv_indom_t;
71
73 The function returns the address of the memory mapped region on success
74 or NULL on failure.
75
77 mmv_inc_value(3), mmv_lookup_value_desc(3) and mmv(4).
78
79
80
81Performance Co-Pilot MMV_STATS_INIT(3)