pcp
[Top] [All Lists]

Re: getting the currently running process metrics

To: Madhu Sudhan R Tera <mst9696@xxxxxxxxxxx>
Subject: Re: getting the currently running process metrics
From: kenmcd@xxxxxxxxxxxxxxxxx
Date: Wed, 11 Jul 2001 22:06:35 +1000 (EST)
Cc: pcp@xxxxxxxxxxx
In-reply-to: <Pine.GSO.4.21.0107060929590.24498-100000@pollux.cis.ksu.edu>
Reply-to: kenmcd@xxxxxxxxxxxxxxxxx
Sender: owner-pcp@xxxxxxxxxxx
On Fri, 6 Jul 2001, Madhu Sudhan R Tera wrote:

> Hello!
> Thank you for your quick response.
> 
> As mentioned in my previous mail,i have recently installed PCP.
> 
> But is there a procedure to pass process ids and get the metrics
> while writing a PMAPI??

You'll need pmLookupDesc(3) to get the instance domain number associated
with the metrics you are interested in, and then pmGetInDom(3) and/or
pmLookupInDom(3) to process the instance domain that encodes the
process ids.  Then pmAddProfile(3) and pmDelProfile(3) to build/update a
"profile".  And finally pmFetch(3) to actually do the work.

You can see an example of all of this in the source for pmval, e.g.
the command

    $ pmval -i 920 proc.psinfo.utime

reports the user CPU time for process id 920.

To get some idea of the interaction between the client (pmval in this
case) and pmcd below the PMAPI, use the PDU tracing option:

    $ pmval -i 920 -D pdu proc.psinfo.utime

> ... And what is this process.psinfo.stime and
> others in pminfo command(As far as i understand its a namespace.Correct me
> if i am wrong!)

I'm not going to explain them, that's the PMDA writer's job ... the -T option 
to pminfo requests the
help text for the named metrics, e.g.

    $ pminfo -T proc.psinfo.utime

    proc.psinfo.utime
    Help:
    time (in ms) spent executing user code since process started



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