Very simple timer module for perl
Simply create a new TinyTimer object:
my $timer = TinyTimer->new;
Then "start" and "stop" in your code for time deltas.
$timer->start;
.
.
<CODE>
.
.
$time->stop;
On "stop" the "delta" property is populated and can be used.
print $timer->delta;
Output:
0.0003447273118
That's it!
###MAIN METHODS### ####new Constructor for TinyTimer
####start Starts a new timer at '0' ('Time::HiRes::time' populates the "start" property)
####stop Takes current time, 'Time::HiRes::time', and populates the "stop" property. This will also call "_delta"
####delta Returns the "delta" property.
####split Returns a split time from the last '_stop'. Will initiate a '_stop'.
####local Returns the "local" property generated by "_init".
###PRIVATE METHODS###
####_init
Adds a localtime returned from date
system call useful for reference to overall start time of scripts.
####_delta Takes the currently stored "start" & "stop" and calculates the delta. Populates the "delta" property. ####_split Takes the currently stored "_start" & "_stop" and calculates the delta. Populates the "_split" property.
Derek Smith drsmith.phys--AT--gmail.com