On 03/25/2013 08:56 PM, Nathan Scott wrote:
I also came across pcpi.py
There was an example that I still have saved away that worked with the
original bindings. The current upstream bindings allow vector inputs
for the primary routines, so it is a bit easier to use the raw calls now
I think. Except for pmExtractValue which is still only one value fetch
at a time.
# Get ids for number cpus and load metrics
(code, metric_ids) = pm.pmLookupName(("hinv.ncpu","kernel.all.load"))
# Get the description of the metrics
(code, descs) = pm.pmLookupDesc(metric_ids)
# Fetch the current value for number cpus
(code, results) = pm.pmFetch(metric_ids)
# Extract the value into a scalar value
(code, atom) = pm.pmExtractValue(results.contents.get_valfmt(0),
results.contents.get_vlist(0, 0),
descs[0].contents.type,
pmapi.PM_TYPE_U32)
Unfortunately pcpi.py currently doesn't work due to the above changes.
I am looking at getting it working again.
|