Tom Molesworth

NAME

Time::Checkpoint::Sequential - record time taken between points in code

VERSION

version 0.002

SYNOPSIS

 use Time::Checkpoint::Sequential;
 my $checkpoint = Time::Checkpoint::Sequential->new(report_on_destroy => 0);
 slow_operation();
 $checkpoint->mark('Perform some operation');
 another_operation();
 $checkpoint->mark('Do something else');
 $checkpoint->report(sub { warn " Timing info: @_\n"; });

DESCRIPTION

METHODS

new

Instantiate the object.

Accepts the following named parameter:

  • report_on_destroy - if true, will call "report" when destroyed, default is true

mark

Records this event. Takes a scalar which will be used as the name for this event.

reset_timer

Updates the timer so that the next recorded event will be from now, rather than the last time.

report

Generates a report. Pass a code ref to customise the output (will be called for each item and then a final time for the total).

DESTROY

Shows report when this object goes out of scope, unless disabled in the constructor.

SEE ALSO

  • Time::Checkpoint which does almost the same as this but not quite in the way I wanted.

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

Copyright Tom Molesworth 2011. Licensed under the same terms as Perl itself.