package cz.martinstainer;

import java.util.regex.Matcher;

import org.apache.jmeter.samplers.SampleResult;

import cz.martinstainer.helper.TPerfResultGetter;

public class TestTPerfResultGetter {


    public static void main(String[] args) {

        String output = "I0428 13:24:32.607162 27267 tperf.cpp:495] TPerfClient connecting to [::1]:6666\n" +
                "I0428 13:24:32.612251 27267 tperf.cpp:424] TPerfClient: onTransportReady\n" +
                "I0428 13:24:42.615141 27267 tperf.cpp:434] TPerfClient connection end\n" +
                "I0428 13:24:42.615186 27267 tperf.cpp:355] Received 1272707864 bytes in 10 seconds.\n" +
                "I0428 13:24:42.615191 27267 tperf.cpp:357] Overall throughput: 970.999Mb/s\n" +
                "I0428 13:24:42.615218 27267 tperf.cpp:361] Average per Stream throughput: 970.999Mb/s over 1 streams\n";

        Matcher matcher = TPerfResultGetter.get(output);
        while(matcher.find()) {
            float number = Float.parseFloat(matcher.group().substring(0, 5));

            System.out.println("Test: "+ number);

        }
    }


}
