package cz.martinstainer;

import cz.martinstainer.helper.IPerfResultGetter;

import org.apache.jmeter.samplers.SampleResult;

import java.util.regex.Matcher;

public class TestIperfResultGetter {


    public static void main(String[] args) {

        String output = "[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams\n" +
                "[  5]   0.00-7.13   sec   913 KBytes  1.05 Mbits/sec  0.000 ms  0/655 (0%)  sender\n" +
                "[  5]   0.00-7.13   sec  0.00 Bytes  0.00 Mbits/sec  0.000 ms  0/0 (0%)  receiver\n";

        Matcher matcher = IPerfResultGetter.get(output, "Gbit");
        while(matcher.find()) {
            SampleResult sr= new SampleResult();
            float number = Float.parseFloat(matcher.group().substring(0, 4));
            System.out.println(number * 1024 * 1024 * 1024);
        }

    }


}
