Time::HiRes is a very good module to use. Especially if you need to take your benchmarking down to the microsecond. I have a module written around this already. I haven't completed the documentation, but the synopsis is really enough to get you working with it. To use it just:
use Time::Chrono;
my $sw = Time::Chrono->new();
$sw->start();
---- execute some code
#-- print how long it took. printf("Took %7.4f seconds to complete", $sw->stop());
It can also be used a bit differently too. But this is the simplest way. If interested let me know.
regards,
Ian
Randall Perry wrote:
Was searching through CPAN trying to find a timer that could provide formatted output for elapsed time so I can time file uploads I'm automating with WWW::Mechanize.
Found a timer function to use, Time::HiRes, but couldn't find anything that could output elapsed time in format mm:ss.
I'm about to write my own code but wanted to ask if anyone knows a module that can do this.
BTW, it may not be apropos, but it would be cool to have a built-in timer method in LWP::UserAgent so requests and posts could be timed.