File: Ping.pm

package info (click to toggle)
libdr-tarantool-perl 0.45-2
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 700 kB
  • ctags: 519
  • sloc: perl: 8,181; ansic: 2,398; makefile: 25; sh: 3
file content (40 lines) | stat: -rw-r--r-- 670 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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;