Benchmark-Timer

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

    - inc
    - private-lib
    - t
  file:
    - delta.pl
requires:
  Time::HiRes: 0
  perl: '5.005'
resources:
  bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Benchmark-Timer
  homepage: https://github.com/coppit/benchmark-timer/
  license: http://opensource.org/licenses/gpl-2.0.php
  repository: https://github.com/coppit/benchmark-timer.git
version: '0.7112'

README  view on Meta::CPAN

Just "perldoc Benchmark::Timer". After installation on Unix systems,
you can also do "man Benchmark::Timer".


RESOURCES

The CPAN Page:
http://search.cpan.org/~dcoppit/Benchmark-Timer/

The GitHub page:
https://github.com/coppit/benchmark-timer/

Bug and feature tracking:
http://rt.cpan.org/Public/Dist/Display.html?Name=Benchmark-Timer


COPYRIGHT

Copyright (c) 2001-2002 Andrew Ho. Copyright (c) 2004-2015 David Coppit. All rights
reserved, save those granted by the license. See the file LICENSE for
licensing terms.

lib/Benchmark/Timer.pm  view on Meta::CPAN

    my $tag = shift || $self->[LASTTAG] || '_default';

    croak 'must call $t->start($tag) before $t->stop($tag)'
        unless exists $self->[SKIPCOUNT]->{$tag};

    return if $self->[SKIPCOUNT]->{$tag} > 0;

    my $i = exists $self->[ELAPSED]->{$tag} ?
        scalar @{$self->[ELAPSED]->{$tag}} : 0;
    my $before = $self->[BEFORE]->{$tag}->[$i];
    croak 'timer out of sync' unless defined $before;

    # Create a stats object if we need to
    if (defined $self->[CONFIDENCE] && !defined $self->[STAT]->{$tag})
    {
      $self->[STAT]->{$tag} = Statistics::PointEstimation->new;
      $self->[STAT]->{$tag}->set_significance($self->[CONFIDENCE]);
    }

    my $elapsed = tv_interval($before, $after);

lib/Benchmark/Timer.pm  view on Meta::CPAN

In all of the following methods, C<$tag> refers to the user-supplied name of
the code being timed. Unless otherwise specified, $tag defaults to the tag of
the last call to C<start()>, or "_default" if C<start()> was not previously
called with a tag.

=over 4

=item $t = Benchmark::Timer->new( [options] );

Constructor for the Benchmark::Timer object; returns a reference to a
timer object. Takes the following named arguments:

=over 4

=item skip

The number of trials (if any) to skip before recording timing information.

=item minimum

The minimum number of trials to run.

lib/Benchmark/Timer.pm  view on Meta::CPAN

margin you have specified. C<need_more_samples()> will use this value to
compute the estimated error for the collected data, so that it can determine
when it is okay to stop.

If you specify a confidence you must also specify an error.

=back

=item $t->reset;

Reset the timer object to the pristine state it started in.
Erase all memory of tags and any previously accumulated timings.
Returns a reference to the timer object. It takes the same arguments
the constructor takes.

=item $t->start($tag);

Record the current time so that when C<stop()> is called, we can calculate an
elapsed time. 

=item $t->stop($tag);

Record timing information. If $tag is supplied, it must correspond to one
given to a previously called C<start()> call. It returns the elapsed time in
milliseconds.  C<stop()> croaks if the timer gets out of sync (e.g. the number
of C<start()>s does not match the number of C<stop()>s.)

=item $t->need_more_samples($tag);

Compute the estimated error in the average of the data collected thus far, and
return true if that error exceeds the user-specified error. If a $tag is
supplied, it must correspond to one given to a previously called C<start()>
call. 

This routine assumes that the data are normally distributed.



( run in 0.301 second using v1.01-cache-2.11-cpan-87723dcf8b7 )