Commit 1735533a authored by Deathcrow's avatar Deathcrow
Browse files

added iperf3 json file support

parent 42196a14
......@@ -6,6 +6,7 @@
import argparse
import copy
import json
import math
import os
import re
......@@ -88,6 +89,10 @@ rtt_values_file = tempfile.TemporaryFile(mode='r+')
bw_values_file = tempfile.TemporaryFile(mode='r+')
netperf_throughput_file = tempfile.TemporaryFile(mode='r+')
netperf_retrans_file = tempfile.TemporaryFile(mode='r+')
iperf3_throughput_file = tempfile.TemporaryFile(mode='r+')
iperf3_retrans_file = tempfile.TemporaryFile(mode='r+')
iperf3_host_cpu_file = tempfile.TemporaryFile(mode='r+')
iperf3_remote_cpu_file = tempfile.TemporaryFile(mode='r+')
rtt_file_lines = 0
bw_file_lines = 0
......@@ -146,7 +151,14 @@ for folder in args.folders:
elif count == 42:
netperf_retrans_file.write(line[24:])
netperf_file.close()
elif file[:7+len(args.mask)] == "iperf3_"+args.mask:
with open(path + "/" + file) as iperf3_file:
json_data = json.load(iperf3_file)
iperf3_throughput_file.write(str(json_data["end"]["sum_sent"]["bits_per_second"] / 1000000) + "\n")
iperf3_retrans_file.write(str(json_data["end"]["sum_sent"]["retransmits"]) + "\n")
iperf3_host_cpu_file.write(str(json_data["end"]["cpu_utilization_percent"]["host_total"]) + "\n")
iperf3_remote_cpu_file.write(str(json_data["end"]["cpu_utilization_percent"]["remote_total"]) + "\n")
bw_values_file.seek(0)
#print(bw_values_file.read())
......@@ -154,8 +166,14 @@ bw_values_file.seek(0)
rtt_values_file.seek(0)
netperf_throughput_file.seek(0)
netperf_retrans_file.seek(0)
iperf3_throughput_file.seek(0)
iperf3_retrans_file.seek(0)
iperf3_host_cpu_file.seek(0)
iperf3_remote_cpu_file.seek(0)
def statify_list(sorted_list, n):
def statify_list(sorted_list):
n = len(sorted_list)
avg = sum( sorted_list ) / n
std_deviation = math.sqrt((1/(n - 1)) * sum( [ (value-avg)**2 for value in sorted_list ] ))
q_25 = quantil(sorted_list, 0.25)
......@@ -222,32 +240,74 @@ sorted_bw = sorted([ float(line) for line in bw_values_file ])
sorted_rtt = sorted([ float(line) for line in rtt_values_file ])
sorted_netperf_throughput = sorted([ float(line) for line in netperf_throughput_file ])
sorted_netperf_retrans = sorted([ float(line) for line in netperf_retrans_file ])
sorted_iperf3_throughput = sorted([ float(line) for line in iperf3_throughput_file ])
sorted_iperf3_retrans = sorted([ float(line) for line in iperf3_retrans_file ])
sorted_iperf3_host_cpu = sorted([ float(line) for line in iperf3_host_cpu_file ])
sorted_iperf3_remote_cpu = sorted([ float(line) for line in iperf3_remote_cpu_file ])
print(sorted_iperf3_throughput)
print("Bandwidth: ")
print("=============================")
sorted_bw = statify_list(sorted_bw, len(sorted_bw))
sorted_bw = statify_list(sorted_bw)
print("")
print("Round Trip Time: ")
print("=============================")
sorted_rtt = statify_list(sorted_rtt, len(sorted_rtt))
print("")
print("Netperf Throughput: ")
print("=============================")
if len(sorted_netperf_throughput) == 1:
sorted_netperf_throughput += sorted_netperf_throughput
sorted_netperf_throughput = statify_list(sorted_netperf_throughput, len(sorted_netperf_throughput))
print("")
print("Netperf Retransmissions: ")
print("=============================")
if len(sorted_netperf_retrans) == 1:
sorted_netperf_retrans += sorted_netperf_retrans
sorted_netperf_retrans = statify_list(sorted_netperf_retrans, len(sorted_netperf_retrans))
sorted_rtt = statify_list(sorted_rtt)
if len(sorted_netperf_throughput):
print("")
print("Netperf Throughput: ")
print("=============================")
if len(sorted_netperf_throughput) == 1:
sorted_netperf_throughput += sorted_netperf_throughput
sorted_netperf_throughput = statify_list(sorted_netperf_throughput)
if len(sorted_netperf_throughput):
print("")
print("Netperf Retransmissions: ")
print("=============================")
if len(sorted_netperf_retrans) == 1:
sorted_netperf_retrans += sorted_netperf_retrans
sorted_netperf_retrans = statify_list(sorted_netperf_retrans)
if len(sorted_iperf3_throughput):
print("")
print("Iperf3 Throughput: ")
print("=============================")
if len(sorted_iperf3_throughput) == 1:
sorted_iperf3_throughput += sorted_iperf3_throughput
sorted_iperf3_throughput = statify_list(sorted_iperf3_throughput)
if len(sorted_iperf3_retrans):
print("")
print("Iperf3 Retrans: ")
print("=============================")
if len(sorted_iperf3_retrans) == 1:
sorted_iperf3_retrans += sorted_iperf3_retrans
sorted_iperf3_retrans = statify_list(sorted_iperf3_retrans)
if len(sorted_iperf3_host_cpu):
print("")
print("Iperf3 Host CPU Usage: ")
print("=============================")
if len(sorted_iperf3_host_cpu) == 1:
sorted_iperf3_host_cpu += sorted_iperf3_host_cpu
sorted_iperf3_host_cpu = statify_list(sorted_iperf3_host_cpu)
if len(sorted_iperf3_remote_cpu):
print("")
print("Iperf3 Remote CPU Usage: ")
print("=============================")
if len(sorted_iperf3_remote_cpu) == 1:
sorted_iperf3_remote_cpu += sorted_iperf3_remote_cpu
sorted_iperf3_remote_cpu = statify_list(sorted_iperf3_remote_cpu)
from pylab import *
boxplot(sorted_bw)
show()
boxplot(sorted_rtt)
show()
#boxplot(sorted_bw)
#show()
#boxplot(sorted_rtt)
#show()
#rtt_q_25 = quantil(sorted_rtt, 0.25)
#rtt_q_75 = quantil(sorted_rtt, 0.75)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment