Hi, Stan -
scox wrote:
> [...]
> pm_code = pcp.pmNewContext()
> if (pm_code < 0):
> print "PCP is not running"
> exit
Some encoding of the error would be nice. Is the context value hidden
inside the pm_code object, or inside the pcp library? If the latter,
this would be a problem for apps that want to juggle between multiple
contexts. Could pcp.pmNewContext() return a python context object
upon which further calls would be made?
> cpu_name = pcp.pmLookupName("hinv.ncpu")
> cpu_desc = pcp.pmLookupDesc(cpu_name)
> cpu_result = pcp.pmFetch(cpu_name)
> ncpu = pcp.pmExtractValue(cpu_result, cpu_desc, cpu_name[0], 0, "PM_TYPE_U32")
I wonder if it should be necessary to do all that
LookupDesc/Fetch/ExtractValue as separate steps. Could these be
combined into a single
ncpu = pcp.pmFetch("hinv.ncpu" /* or array of same */,
[0] /* instances */,
PM_TYPE_U32 /* requested format */)
and have pmFetch internally do the pmLookupDesc / pmFetch / pmExtractValue?
(Or else have another combined function that does the same?)
> [...]
> metrics = ("kernel.all.load", "kernel.percpu.cpu.user",
> "kernel.percpu.cpu.sys", "mem.freemem", "disk.all.total")
> metric_names = pcp.pmLookupName(metrics)
> metric_descs = pcp.pmLookupDesc(metric_names)
This vectorish approach looks nice!
- FChE
|