[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: process time lapsed in perl?
On Thu, 16 Nov 2000, Anand D Sankruthi wrote:
> Hi all,
> Is there any way to wait for a process to complete ( which i initiated using
> my code), before proceeding further. i also need to know the time lapsed for
> the process to complete. i use perl in linux.
> thanx
There are several ways. One very simple method would be:
$Stime = time();
system("ls -l /");
$Etime = time();
print "It took ", $Etime-$Stime, " Seconds !\n";
That would give you precision upto a second. If you want better timing,
do:
use Benchmark;
$Stime = new Benchmark;
system("ls -l /");
$Etime = new Benchmark;
print "It took ", timestr(timediff($Etime, $Stime)), "\n";
hope that helps
Sreeji
----
It said Windows 95 or better. So I used Linux.