On 9/29/07, Chad Mynhier <cmynhier at gmail.com> wrote:
> I'm trying to implement the "ptime -p <pid>" part of
> http://bugs.opensolaris.org/view_bug.do?bug_id=4532599.  (I'm aware
> that the bug/RFE is marked "6-Fix understood", but the responsible
> engineer is no longer at Sun, so I don't know what progress might be
> made on it.)
>
> What should the semantics of "ptime -p <pid> be?  I see two options:
> - ptime should report usage after the specified process has finished.
> - ptime should report statistics for the process up to that point
> (i.e., ptime returns almost immediately.)

For the first one I think it's actually when ptime finishes - whether that's
because the process exits or you ctrl-C out of ptime.

I think there are two questions that could be asked of a process:

 - what have you used so far? (your second option)

 - at what rate are you currently accumulating all the statistics?

I'm not sure that waiting for the process to end is going to be used
much; I would expect to use ptime -p to report on long-running
processes (daemons, even).

We would probably need both. You say giving the total for a process
is easy, so we should definitely have that as-is.

I'm not exactly how best to give the user the information in
my second case. It could, after all, be emulated by running
ptime repeatedly against the process and calculating the
differences. Would something like adding an interval and count
like some of the other stat utilities and getting it to print out
the rates work?

This might be easy to implement. It's just like doing it once,
saving the values, and doing it again n seconds later. You
don't have to wait on the process, you just have to detect
when it's gone so you know to exit.

-- 
-Peter Tribble
http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/

Reply via email to