NAME

Net::Iperf::Parser - Parse a single iperf line result

github workflow tests Top language: github last commit

VERSION

version 0.04

SYNOPSIS

use Net::Iperf::Parser;

my $p = new Net::Iperf::Parser;

my @rows = `iperf -c iperf.volia.net -P 2`;

foreach (@rows) {
  $p->parse($_);
  print $p->dump if ($p->is_valid && $p->is_global_avg);
}

and result is something like this

{
    is_valid          => 1,
    start             => 0,
    end               => 10,
    duration          => 10,
    speed             => 129024,
    speedk            => 126,
    speedm            => 0.123046875,
    is_process_avg    => 1,
    is_global_avg     => 1,
}

DESCRIPTION

Parse a single iperf line result in default or CSV mode

METHODS

start

Return the start time

end

Return the end time

is_valid

Return if the parsed row is a valid iperf row

is_process_avg

Return if the row is a process average value

is_global_avg

Return if the row is the last summary value

speed

Return the speed calculated in bps

speedk

Return the speed calculated in Kbps

speedm

Return the speed calculated in Mbps

dump

Return a to_string version of the object (like a Data::Dumper::dumper)

parse($row)

Parse a single iperf line result

parsecsv($row)

Parse a single iperf line result in CSV mode (-y C)

SEE ALSO

iperf

AUTHOR

Emiliano Bruni <info@ebruni.it>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019-2023 by Emiliano Bruni.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.