pcp
[Top] [All Lists]

Derived metric issues

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: Derived metric issues
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Tue, 9 Feb 2016 09:43:04 +0200
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0
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

<Prev in Thread] Current Thread [Next in Thread>