Time::Checkpoint
Simple module to report deltas between waypoints in code, with extensible reactions.
my $t = Time::Checkpoint->new( ); $t->checkpoint( 'Start' ); # Code elapses ... my $delta = $t->checkpoint( 'Start' ); # With callback my $t = Time::Checkpoint->new( callback => \&print_delta ); $t->checkpoint( 'foo' ); sub print_delta { my ($checkpoint, $old_time, $new_time) = (@_); my $delta = $new_time - $old_time; $LOG->debug( "$checkpoint: delta $delta seconds" ); } # More code elapses... $t->checkpoint( 'foo' ); # print_delta is called
The constructor takes either no arguments or a hash with one key: callback. If a callback is passed (a code ref), that code will be called with the arguments $name_of_checkpoint, $old_timestamp, $new_timestamp. Returns a Time::Checkpoint object.
Takes one argument, the name of the checkpoint reached. When called, it will perform a hash lookup to determine when it was called last. It will return the delta between the two. It will also call the 'callback' code, as mentioned above, provided it exists.
Takes no arguments. Returns a hash of checkpoints and their timestamps.
Returns the timestamp for a given checkpoint, or undef.
Removes the specified checkpoint, returning its value if it had one.
Removes all checkpoints.
Jane A. Avriette <jane@cpan.org>
Yep.
3 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
To install Time::Checkpoint, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Time::Checkpoint
CPAN shell
perl -MCPAN -e shell install Time::Checkpoint
For more information on module installation, please visit the detailed CPAN module installation guide.