pcp
[Top] [All Lists]

Re: proc.psinfo.psargs and arguments

To: Mike Mason <mmlnx@xxxxxxxxxx>
Subject: Re: proc.psinfo.psargs and arguments
From: Ken McDonell <kenmcd@xxxxxxxxxxxxxxxxx>
Date: Tue, 23 Apr 2002 12:18:31 +1000
Cc: pcp@xxxxxxxxxxx
Sender: owner-pcp@xxxxxxxxxxx
Sorry, this got caught up in an internal mail problem between the
South Pacific and oss.sgi.com, and was only recently discovered by
mailbox archaeologists.

---------- Original message -------------

Date: Wed, 17 Apr 2002 08:16:04 +1000
From: Ken McDonell <kenmcd@xxxxxxxxxxxxxxxxx>
To: Mike Mason <mmlnx@xxxxxxxxxx>
cc: pcp@xxxxxxxxxxx
Subject: Re: proc.psinfo.psargs and arguments

On 16 Apr 2002, Mike Mason wrote:

> Is proc.psinfo.psargs supposed to pass back the command name and
> arguments or just the command name?  In the code it looks like the
> intention is to include both the command and arguments from
> /proc/<pid>/cmdline.  But since cmdline outputs this info as individual
> null-terminated strings, we only ever see the command name.  Is this
> intentional?

Mike, I expect this is a bug, or more correctly 3 bugs.

Consider this ...

kenj-pc 11% ps -ef | grep pppd
root     29029 29010  0 04:50 pts/3    00:00:00 /usr/sbin/pppd /dev/modem 38400
kenmcd   32190 14156  0 08:02 pts/5    00:00:00 grep pppd
kenj-pc 12% pminfo -f proc.psinfo.psargs | grep pppd
    inst [29029 or "029029 /usr/sbin/pppd"] value "029029 /usr/sbin/pppd"

proc.psinfo.psargs should have the value "/usr/sbin/pppd /dev/modem
38400" so (1) _really_ add the args, and (2) drop the pid prefix,
"029029 ", and (3) the instance domain (for all proc metrics) should
have instances names of the form "<pid> <psargs>" rather than "<pid>
basename(argv[0])".

(3) is _really_ important, because we need to be able to select
instances based on pathname to the exec'd binary and/or command
arguments ... this is essential for tools that want to find processes
but don't know the exlplicit pid(s).

There probably should _another_ metric proc.psinfo.fname with the
values basename(argv[0]).

For comparison, here are the related metrics from IRIX ...

rattle 11% ps -ef | grep pmcd
    root        936          1  0   Apr 04 ?      34:13 /usr/etc/pmcd -T 3
rattle 12% pminfo -F proc.psinfo.psargs | grep '[p]mcd'
    inst [936 or "0000000936 /usr/etc/pmcd -T 3"] value "/usr/etc/pmcd -T 3"
rattle 13% pminfo -F proc.psinfo.fname | grep '[p]mcd'
    inst [936 or "0000000936 /usr/etc/pmcd -T 3"] value "pmcd"

> I need to get the arguments as well as the command from PCP.  Changing
> proc.psinfo.psargs make break existing apps that are dependent on its
> current behavior.  Should I fix proc.psinfo.psargs or add another
> metric?

I'd be inclined to fix it ... since the existing implementation
returns so little information of value, I would not be too concerned
about preserving current behaviour, especially in the light of the
IRIX precedent.

Mark did this this code originally, so I'll leave it to him to
correct my suggestions if there is justification for the status quo.


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