PMGENMAP - Online Linux Manual PageSection : 1
Updated : PCP
Source : Performance Co-Pilot
NAMEpmgenmap − generate C code to simplify handling of performance metrics
SYNOPSISpmgenmap [infile]
DESCRIPTIONGiven one or more lists of metric names in infile or on standard input, pmgenmap generates C declarations and cpp(1) macros suitable for use across the Performance Metrics Programming Interface (PMAPI) on standard output. The declarations produced by pmgenmap simplify the coding for client applications using the PMAPI. The input should consist of one or more lists of metric names of the form listname {
metricname1 symbolname1
metricname2 symbolname2
...
}
which will generate C and cpp(1) declarations of the form char *listname[] = {
#define symbolname1 0
"metricname1",
#define symbolname2 1
"metricname2",
...
};
The array declarations produced are suitable as parameters to pmLookupName(3) and the #defined constants may be used to index the vsets in the pmResult structure returned by a pmFetch(3) call. Obviously, listname must conform to the C identifier naming rules, each symbolname must conform to the cpp(1) macro naming rules, and each metricname is expected to be a valid performance metrics name (see PMNS(5) for more details). The input may include sh-style comment lines, i.e. with a `#' as the first non-blank character of a line, and these are translated on output to either single line or multi-line C comments in the K&R style. For example, the input: # leading block of multi-line comments
# initialization group
foo {
a.b.c ONE
d.e.f.g TWO
# embedded block of multi-lines
# comments and boring pad text
xx.yy.zz THREE
}
# trailing single line comment
Produces the output: /*
* leading block of multi-line comments
* initialization group
*/
char *foo[] = {
#define ONE 0
"a.b.c",
#define TWO 1
"d.e.f.g",
/*
* embedded block of multi-lines
* comments and boring pad text
*/
#define THREE 2
"xx.yy.zz",
};
/* trailing single line comment */
EXAMPLESFor brevity we have removed the error handling code, and assumed the chosen metrics do not have multiple values. The input file mystats {
kernel.percpu.cpu.idle IDLE
kernel.percpu.cpu.sys SYS
kernel.percpu.cpu.user USER
hinv.ncpu NCPU
}
produces the following C code, suitable for #include-ing /*
* Performance Metrics Name Space Map
* Built by pmgenmap from the file
* mystats.metrics
* on Wed Dec 28 19:44:17 EST 1994
*
* Do not edit this file!
*/
char *mystats[] = {
#define IDLE 0
"kernel.percpu.cpu.idle",
#define SYS 1
"kernel.percpu.cpu.sys",
#define USER 2
"kernel.percpu.cpu.user",
#define NCPU 3
"hinv.ncpu",
};
Using the code generated by pmgenmap, we are now able to easily obtain metrics from the Performance Metrics Collection Subsystem (PMCS) as follows: #define MAX_PMID 4
int trip = 0;
int numpmid = sizeof(mystats)/sizeof(mystats[0]);
double duration;
pmResult *resp;
pmResult *prev;
pmID pmidlist[MAX_PMID];
pmNewContext(PM_CONTEXT_HOST, "localhost");
pmLookupName(numpmid, mystats, pmidlist);
pmFetch(numpmid, pmidlist, &resp);
printf("%d CPUs: %d usr %d sys %d idle\n",
resp->vset[NCPU]->vlist[0].value.lval,
resp->vset[USER]->vlist[0].value.lval,
resp->vset[SYS]->vlist[0].value.lval,
resp->vset[IDLE]->vlist[0].value.lval);
Some calls to ensure portability have been removed from the code above for the sake of clarity − the example above should not be used as a template for programming. In particular, the raw values of the metrics were used when pmLookupDesc(3) should have been called to determine the semantics of each metric. More complete examples that demonstrate the use of pmgenmap which may be used as a basis for program development are included in the PCP demos, e.g. $PCP_DEMOS_DIR/pmclient.
FILES$PCP_VAR_DIR/pmns/* default PMNS specification files
PCP ENVIRONMENTEnvironment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5).
SEE ALSOcpp(1), PMAPI(3), pmFetch(3), pmLookupName(3), pmNewContext(3), pcp.conf(5), pcp.env(5) and PMNS(5). 0
Johanes Gumabo
Data Size : 16,850 byte
man-pmgenmap.1Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 203,179
Visitor ID : :
Visitor IP : 18.223.159.143 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (rof_nr_x|149|pmgenmap.1|224|\n",| printf("%d CPUs: %d usr %d sys %d idle\n",
)