On Fri, 2006-31-03 at 14:41 -0700, Bryan Harris wrote:
> 
> I have a script that takes ~5 seconds to run, but I'd like to get it down to
> <1 sec.  My problem is I don't know which part is the slow part.  So given
> something like this:
> 
> **************************************
> #! /usr/bin/perl -w
> 

my $start_time = time;

> (code chunk 1 here)
> 

print "chunk 1: ", time - $start_time, " seconds\n"
$start_time = time;

> (code chunk 2 here)
> 

print "chunk 2: ", time - $start_time, " seconds\n"
$start_time = time;

> 
> (code chunk 3 here)

print "chunk 3: ", time - $start_time, " seconds\n"

> 
> 
> **************************************
> 
> -- is there anything I can wrap around the code chunks to see how long each
> one takes?
> 
> Thanks!
> 
> - Bryan

It's crude but effective.

-- 
__END__

Just my 0.00000002 million dollars worth,
   --- Shawn

"For the things we have to learn before we can do them,
we learn by doing them."
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to