[TriLUG] What's an effective method for timing a perl script

Matt Frye mattfrye at gmail.com
Fri Apr 15 14:47:26 EDT 2005


Let's say I have a perl script that goes something like this:

#!/usr/bin/perl

# glob the list of files
while (defined($nextname = <./*/Recent/*>)) {

...and so on and let's say it deletes a billion files.  What's an
effective way of timing the whole thing?  This needs to be
ultra-portable so not using any modules is a plus.  I started with...

($exectime) = times; 

...but I'm not sure that's giving me what I need.  I tested up to 7500
files and ne'er more than .01 so I want to make sure I'm getting real
data.

Thoughts?

Matt Frye



More information about the TriLUG mailing list