MooseX::Role::Timer(3pm)

MooseX::Role::Timer3pm

Measure times with your object.

Usage

 package Demo;
 use Moose; # or Any::Moose
 with 'MooseX::Role::Timer';
 sub BUILD {
   shift->start_timer("build");
 }
 sub do_something {
   my $self = shift;
   $self->start_timer("something");
   # do something...
   $self->stop_timer("something");
 }
 package main;
 my $demo = Demo->new;
 $demo->do_something;
 $demo->do_something;
 printf "%3.6fs\n", $demo->elapsed_timer("build");     # time spent since BUILD
 printf "%3.6fs\n", $demo->elapsed_timer("something"); # time spent in sub do_something

This Role provides your object with timers, making it easier to keep track of how long whatever actions take.

start_timer($name)

Start timer $name.

stop_timer($name)

Stop timer $name. Could be started again to cumulatively measure time.

reset_timer($name)

Stops timer $name and clears cumulated times for $name.

elapsed_timer('name')

Return the elapsed time in seconds (cumulated) for timer $name.

timer_names

Return all timer names.

Releases

7 releases since Debian 7 (Wheezy); the text changed 4 times.

  1. 7
  2. 8
  3. 9–10
  4. 11
  5. 12–13

Author

Michael Langner, "<mila at cpan.org>"

Bugs

Please report any bugs or feature requests to "bug-moosex-role-timer at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Role-Timer>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

From libmoosex-role-timer-perl 0.05-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.