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