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

Jeremy Portzer jeremyp at pobox.com
Mon Apr 18 14:50:06 EDT 2005


The "time" command's output is very different on different shells within 
*NIX too.  So the all-Perl method is probably much better.

Jeremy

On Fri, 15 Apr 2005, William Sutton wrote:

> Well, yes, if ultra-portable means other OSes than *NIX.  In that case, 
> using some sort of time calculation routine is probably better, and if 
> this is anything inside of a day (sounds likely), probably something one 
> could write one's self...
> 
> William
> 
> 
> On Fri, 15 Apr 2005, Ian Kilgore wrote:
> 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > I was going to say the same thing, but the mention of "ultra-portable"
> > put me off =)
> > 
> > William Sutton wrote:
> > | I'm a little more curious about the application of this than is contained
> > | at first glance in the description.  Are you trying to time the entire
> > | process or individual file deletions?  If the whole process, then when
> > you
> > | run it from the command line, you could just do
> > |
> > | $ time my_process.pl
> > |
> > | and when it finishes off, you should see something like
> > |
> > | real    0m0.004s
> > | user    0m0.000s
> > | sys     0m0.000s
> > |
> > | fwiw...William
> > |
> > | On Fri, 15 Apr 2005, Matt Frye wrote:
> > |
> > |
> > |>>my $startTime = time;
> > |>>while(glob('./*/Recent/*')){unlink $_}
> > |>>print time - $startTime,"\n";
> > |>
> > |>Cool, thanks.  Time:HiRes isn't necessary, in fact neither is adding
> > |>stats to my perfectly effective code, but the manager wants to see
> > |>them.  Go figure.
> > |>
> > |>MPF
> > |>--
> > |>TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> > |>TriLUG Organizational FAQ  : http://trilug.org/faq/
> > |>TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> > |>TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
> > |>
> > |>
> > |
> > |
> > 
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.2.5 (GNU/Linux)
> > 
> > iD8DBQFCYB32wsRpgTiXSOERAgcQAJ99dSmakXZePr7PxfgSK6+rGpIoCACfYC79
> > N1gPSYFOFDj7l/S68RCFVAc=
> > =KWnY
> > -----END PGP SIGNATURE-----
> > 
> 
> 

-- 
/---------------------------------------------------------------------\
| Jeremy Portzer        jeremyp at pobox.com      trilug.org/~jeremy     |
| GPG Fingerprint: 712D 77C7 AB2D 2130 989F  E135 6F9F F7BC CC1A 7B92 |
\---------------------------------------------------------------------/



More information about the TriLUG mailing list