Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Perl: the Markov chain saw
 
PerlMonks  

Interpreting the Meaning of Time Method in Proc::ProcessTable

by monkfan (Curate)
on Oct 26, 2007 at 09:53 UTC ( #647351=perlquestion: print w/ replies, xml ) Need Help??
monkfan has asked for the wisdom of the Perl Monks concerning the following question:

I have a following snippet:
use Proc::ProcessTable; my $now = time; print "NOW:", scalar(localtime $now),"\n"; $t = new Proc::ProcessTable; printf( $FORMAT, "START", "HOWLONG", "CMD" ); foreach $p ( @{ $t->table } ) { printf( $FORMAT, scalar( localtime( $p->start ) ), $p->time, ); } }
And it prints:
NOW :Fri Oct 26 17:37:58 2007
and in one of the entry it prints: prints:
START HOWLONG Fri Oct 26 03:23:00 2007 120000
I was wondering what does the figure 12000 mean? The doc doesn't seem to describe it tangibly:
time user + system time
Does that figure describe howlong a particular program is running? Is that in seconds?

Regards,
Edward

Comment on Interpreting the Meaning of Time Method in Proc::ProcessTable
Select or Download Code
Re: Interpreting the Meaning of Time Method in Proc::ProcessTable
by kyle (Abbot) on Oct 26, 2007 at 12:13 UTC

    It's how much CPU time the process has used (in seconds, I assume). 'User' time is how much time was spent in the program itself and 'system' time is how much time was spent in the operating system servicing the program's requests.

    Update: Upon further reflection, I don't think that time is in seconds. Proc::ProcessTable::Process says that utime is in 1/100s of seconds, so that's probably what time is in too. Your 120000 figure is 33 hours as seconds and 20 minutes as 1/100s of seconds. If you're still in doubt, you could see what it says about "perl -e '$i++ while 1'" after ten seconds. My guess is it will be about 1000.

      Sorry, but I still don't get it... ProcessTable says this:
      PID    PPID   SIZE         RSS          TIME         COMMAND
      19524  14920  936000       762796       55550000     /tools/atoptech/AP_07.06-06.27/Linux/bin/rhel3-64/AP 
      
      and ps says this about the same process:
      % ps -o 'ppid pid vsz rss time command'
       PPID   PID   VSZ  RSS     TIME COMMAND
      14920 19524 936000 762796 00:00:55 /tools/atoptech/AP_07.06-06.27/Linux/bin/rhel3-64/AP
      
      Thanks, Jim

        It looks as if ps is reporting time in seconds (hours, minutes, seconds, separated by colons) and Proc::ProcessTable is reporting it in microseconds. If what you have is microseconds, you can convert that to seconds by dividing by one million.

        my $microseconds = 55550000; my $seconds = $microseconds / 1_000_000;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://647351]
Approved by Corion
Front-paged by neversaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2013-05-18 11:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (392 votes), past polls