Jeremy Jones wrote:
> Hello all,
>
> does anyone know of a built-in Perl function that can divine a processes
> start-time?
>
> EXAMPLE :
>
> on UNIX Systems :
>
> <USERID> <PID> <PPID> <C> 10:51:44 pts/75 0:01 xterm -e
>
> the underlined time is how long the process has been running.
> Is there a better way, using pre-packaged Mods to find this out for
> comparison with another process runtime?
> (without regexing the time out of the PS list and comparing it to another
> regexed Process-Time I mean...)
>
take a look 'perldoc -f times'. an example would be:
#!/usr/bin/perl -w
use strict;
while(1){
$_ = sqrt($_) for(1..100000);
print "@{[times]}\n";
sleep(1);
}
__END__
prints:
0.22 0.01 0 0
0.43 0.01 0 0
0.64 0.01 0 0
0.85 0.01 0 0
...
first is user time, second is system time (process spent executing kernel
calls), the third and fourth is for child process which it doesn't have
any.
david
--
s$s*$+/<tgmecJ"ntgR"tgjvqpC"vuwL$;$;=qq$
\x24\x5f\x3d\x72\x65\x76\x65\x72\x73\x65
\x24\x5f\x3b\x73\x2f\x2e\x2f\x63\x68\x72
\x28\x6f\x72\x64\x28\x24\x26\x29\x2d\x32
\x29\x2f\x67\x65\x3b\x70\x72\x69\x6e\x74
\x22\x24\x5f\x5c\x6e\x22\x3b\x3b$;eval$;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>