DR-Tarantool

 view release on metacpan or  search on metacpan

st/Check/Ping.pm  view on Meta::CPAN

use utf8;
use strict;
use warnings;

package Check::Ping;

use constant ITERATIONS => cfg 'check.ping.iterations';

sub start {

    my $done_time = 0;
    my $total = 0;

    while(1) {

        my $started = now();
        for (my $i = 0; $i < ITERATIONS; $i++) {
            die "Can't ping tarantool\n" unless tnt->ping;
        }

        my $period = now() - $started;
        $done_time += $period;
        $total += ITERATIONS;


        df "done %d pings in %3.2f seconds",
            $total,
            $done_time
        ;

            
        df "%d r/s, %3.5f s/r",
            $total / $done_time,
            $done_time / $total
        ;

    }
}

1;



( run in 0.450 second using v1.01-cache-2.11-cpan-71847e10f99 )