On Mon, 19 Mar 2001 23:41:33 Ted Hilts wrote:
>This is my second perl problem.
>
>I have this ftp routine and want to be able to measure the time
>associated with each step in the routine.  You can see a routine snippet
>on the list where I submitted the first problem and it is called Perl
>Problem.
>
>Before each $ftp step I want to be able to set up a condition so that
>when the step completes I can determine how long the $ftp step took.  So
>I want an ongoing determination of the time in the form of time
>durations, not just a print out of what time it is.  By this means I can
>monitor the routine and become aware of any problems.  Also, I would
>like to be able (withing the perl code) to detect any time durations
>exceeding a specified amount.

set_chkpoint;
...FTP commands here
print_time;

sub set_chkpoint {
    $chkpoint = `date +%s`;
    chomp($chkpoint);
}

sub print_time {
    $currtime = `date +%s`;
    chomp($currtime);
    $elasped_time = $currtime - $chkpoint;
    print "Elasped time: $elasped_time\n";
}


-- 
Anthony E. Greene <[EMAIL PROTECTED]> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
Chat:  AOL/Yahoo: TonyG05    ICQ: 91183266
Linux. The choice of a GNU Generation. <http://www.linux.org/>



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to