EnglishFrenchSpanish

OnWorks favicon

pmgenmap - Online in the Cloud

Run pmgenmap in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command pmgenmap that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


pmgenmap - generate C code to simplify handling of performance metrics

SYNOPSIS


pmgenmap [infile]

DESCRIPTION


Given 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 */

EXAMPLE


For 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 idle0,
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.

Use pmgenmap online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    KompoZer
    KompoZer
    KompoZer is a wysiwyg HTML editor using
    the Mozilla Composer codebase. As
    Nvu's development has been stopped
    in 2005, KompoZer fixes many bugs and
    adds a f...
    Download KompoZer
  • 2
    Free Manga Downloader
    Free Manga Downloader
    The Free Manga Downloader (FMD) is an
    open source application written in
    Object-Pascal for managing and
    downloading manga from various websites.
    This is a mirr...
    Download Free Manga Downloader
  • 3
    UNetbootin
    UNetbootin
    UNetbootin allows you to create bootable
    Live USB drives for Ubuntu, Fedora, and
    other Linux distributions without
    burning a CD. It runs on Windows, Linux,
    and ...
    Download UNetbootin
  • 4
    Dolibarr ERP - CRM
    Dolibarr ERP - CRM
    Dolibarr ERP - CRM is an easy to use
    ERP and CRM open source software package
    (run with a web php server or as
    standalone software) for businesses,
    foundations...
    Download Dolibarr ERP - CRM
  • 5
    SQuirreL SQL Client
    SQuirreL SQL Client
    SQuirreL SQL Client is a graphical SQL
    client written in Java that will allow
    you to view the structure of a JDBC
    compliant database, browse the data in
    tables...
    Download SQuirreL SQL Client
  • 6
    Brackets
    Brackets
    Brackets is a free, modern open-source
    text editor made especially for Web
    Development. Written in HTML, CSS, and
    JavaScript with focused visual tools and
    prepr...
    Download Brackets
  • More »

Linux commands

Ad