Hi,
Please consider the test case below:
#include <stdio.h>
#include <pcp/pmapi.h>
#define DERIVED_CONF "./d.conf"
// mem.util.allcache = mem.util.cached + mem.util.slab
#define DERIVED_NAME "mem.util.allcache"
int main(int argc, char **argv) {
int sts;
pmID pmid;
pmDesc desc;
char *name = DERIVED_NAME;
sts = pmNewContext(PM_CONTEXT_HOST, "local:");
if (sts < 0) fprintf(stderr, "pmNewContext returned %d!\n", sts);
sts = pmLoadDerivedConfig(DERIVED_CONF);
if (sts < 0) fprintf(stderr, "pmLoadDerivedConfig returned %d!\n", sts);
sts = pmLookupName(1, &name, &pmid);
if (sts < 0) fprintf(stderr, "pmLookupName returned %d!\n", sts);
printf("pmid: %d\n", pmid);
sts = pmLookupDesc(pmid, &desc);
if (sts < 0) fprintf(stderr, "pmLookupDesc returned %d!\n", sts);
printf("desc.pmid: %d\n", desc.pmid);
return 0;
}
1) If the config file is empty and I use a non-derived metric like
mem.util.free then everything works ok as expected
2) If the config file is missing then I get an error code from
pmLoadDerivedConfig as expected
3) If the config file contains only some garbage like "asd" then
I see errors printed while in pmLoadDerivedConfig but it returns
zero - this looks like an obvious bug
4) If the config file contains a valid derived metric definition
then everything works until pmLookupDesc fails. Shouldn't it work
with derived metrics as well?
Thanks,
--
Marko Myllynen
|