Toru Yamaguchi > Loop-Sustainable > Loop::Sustainable::Strategy::ByLoad

Download:
Loop-Sustainable-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Loop::Sustainable::Strategy::ByLoad - Calculates wait interval by load.

SYNOPSIS ^

  use Loop::Sustainable;

  loop_sustainable {
      my ( $i, $time_sum ) = @_;
      #### maybe heavy process
  } (
      sub {
           my ($i, $time_sum, $rv ) = @_;
           not defined $rv->[0] ? 1 : 0;
      },
      {
          strategy => {
              class => 'ByLoad',
              args  => { load => 0.5 },
          }
      }
  );

DESCRIPTION ^

Loop::Sustainable::Strategy::ByLoad provides wait interval time calculated by total execution time and loop execution count, specified load ratio.

METHODS ^

new( %args )

load

The ratio of executed time.

wait_correction( $query, $time_sum, $executed_count )

AUTHOR ^

Toru Yamaguchi <zigorou@dena.jp<gt>

LICENSE ^

This module is licensed under the same terms as Perl itself.

SEE ALSO ^

Loop::Sustainable
syntax highlighting: