Product SiteDocumentation Site

3.9.4. Accommodating Program Evolution

The flexibility provided by the PMAPI and the pmgenmap utility is demonstrated by Example 3.22, “Adding a Metric”. Consider the requirement for reporting a third metric mem.physmem. This example shows how to add the line to the specification file:

Example 3.22. Adding a Metric

mem.freemem PHYSMEM
Then regenerate the #include file, and augment pmclient.c:
   pmExtractValue(crp->vset[PHYSMEM]->valfmt, crp->vset[PHYSMEM]->vlist,
                  desclist[PHYSMEM].type, &tmp, PM_TYPE_FLOAT);
   pmConvScale(PM_TYPE_FLOAT, &tmp, &desclist[PHYSMEM].units,
                    &atom, &mbyte_scale);
# The equivalent python code would be:
val = context.pmExtractValue(crp.contents.get_valfmt(PHYSMEM),
			crp.contents.get_vlist(PHYSMEM, 0),