Time::Checkpoint::Sequential - record time taken between points in code
version 0.002
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"; });
Instantiate the object.
Accepts the following named parameter:
report_on_destroy - if true, will call "report" when destroyed, default is true
Records this event. Takes a scalar which will be used as the name for this event.
Updates the timer so that the next recorded event will be from now, rather than the last time.
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).
Shows report when this object goes out of scope, unless disabled in the constructor.
Time::Checkpoint which does almost the same as this but not quite in the way I wanted.
Tom Molesworth <cpan@entitymodel.com>
Copyright Tom Molesworth 2011. Licensed under the same terms as Perl itself.
To install Time::Checkpoint::Sequential, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Time::Checkpoint::Sequential
CPAN shell
perl -MCPAN -e shell install Time::Checkpoint::Sequential
For more information on module installation, please visit the detailed CPAN module installation guide.