Commit bf909daf authored by Andreas Schmidt's avatar Andreas Schmidt

~= polish notebook

parent 0841f81b
......@@ -3,6 +3,10 @@ import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive
import ipywidgets as widgets
from IPython.display import display
pace_columns = [
"TransReceivePaceInternal",
......@@ -56,6 +60,53 @@ def dts_box(folder, r=None):
plt.xlabel("E2E Delivery Time [ms]")
plt.legend()
def live_receiver_dts_cdf(exp, figsize=(16,6), pkt_max=None, protocols=None, dtopt=None):
df = preprocess("{0}/receiver_{1}.csv".format(exp, "prrt"))
iterations = len(df)
if protocols is None:
protocols = ["prrt","tcp-bbr","tcp-cubic"]
if pkt_max is None:
pkt_max = iterations
t_max = 0
for proto in protocols:
df = preprocess("{0}/receiver_{1}.csv".format(exp, proto))
t_max = max(t_max, df["time"].max())
lengthSlider = widgets.IntSlider(min=10, max=iterations, step=20, value=100,
continuous_update=False, description="Window:")
packetSlider = widgets.IntSlider(step=20,max=iterations, continuous_update=False, description='Packet Idx:',)
play = widgets.Play(value=5, min=1, max=pkt_max, step=1,
disabled=False, continuous_update=False)
widgets.jslink((play, 'value'), (packetSlider, 'value'))
display(widgets.HBox([packetSlider, play]))
display(lengthSlider)
plot = interactive(create_interactive_receiver_dts_cdf(exp, figsize, t_max, protocols, dtopt),
packet_idx=play,
window=lengthSlider)
output = plot.children[-1]
output.layout.height = '350px'
plot.children = (output,)
return plot
def create_interactive_receiver_dts_cdf(exp,
figsize,
t_max,
protocols=None,
dtopt=None):
def _f(packet_idx, window):
receiver_dts_cdf(exp,
r=slice(max(packet_idx - window, 0), packet_idx),
figsize=figsize,
t_max=t_max,
protocols=protocols,
dtopt=dtopt,
grid=True,
legend={"bbox_to_anchor": (1.05, 1.05)}
)
return _f
def receiver_dts_cdf(folder, r=None, protocols=None,
grid=False, figsize=(16, 5),
export=False, file_name="dts_cdf.pdf",
......
......@@ -94,15 +94,38 @@ def experiment_config(folder):
"app_recv_jitter": exp.at[0,"APP_RECV_JITTER"],
"app_send_rate": exp.at[0,"Size"] / exp.at[0,"APP_SEND_PACE"] if exp.at[0,"APP_SEND_PACE"] != 0 else np.inf,
"app_recv_rate": exp.at[0,"Size"] / exp.at[0,"APP_RECV_PACE"] if exp.at[0,"APP_RECV_PACE"] != 0 else np.inf,
#"btlbuf": exp.at[0,"BTLBUF"]
}
def duration_inflate(dfs, proto, exp, length):
last_time = dfs[proto].iloc[-1]["SendT"]
conf = experiment_config(exp)
opt = conf["app_recv_delay"] * length * 1000
return [proto, last_time/1000, opt/1000]
def experiment_config_repr(folder):
c = experiment_config(folder)
c["delay"] = "{:.2f}ms".format(c["delay"] * 1000)
c["jitter"] = "{:.2f}ms".format(c["jitter"] * 1000)
c["rate"] = "{:.2f}Mbps".format(c["rate"] / (1000**2))
c["network_pace"] = "{:.2f}ms".format(c["network_pace"]*1000)
c["size"] = "{}B/packet" .format(c["size"])
c["bdp"] = "{}KB" .format(c["bdp"] / 1000)
c["rcvbuf"] = "{}KB".format(c["rcvbuf"] / 1000)
c["sndbuf"] = "{}KB".format(c["sndbuf"] / 1000)
c["app_send_delay"] = "{}ms".format(c["app_send_delay"] * 1000)
c["app_send_jitter"] = "{}ms".format(c["app_send_jitter"] * 1000)
c["app_send_rate"] = "{}Kbps".format(c["app_send_rate"] / 1000) if c["app_send_rate"] is not np.Inf else "Infinite"
c["app_recv_delay"] = "{}ms".format(c["app_recv_delay"] * 1000)
c["app_recv_jitter"] = "{}ms".format(c["app_recv_jitter"] * 1000)
c["app_recv_rate"] = "{}Kbps".format(c["app_recv_rate"] / 1000) if c["app_recv_rate"] is not np.Inf else "Infinite"
return pd.DataFrame({k: [v] for k,v in c.items()})
def experiment_duration_inflation(protos, dfs, exp, length):
rows = [duration_inflate(dfs, proto, exp, length) for proto in protos]
return pd.DataFrame(rows,columns=["Proto","EXP_ACT [ms]","EXP_OPT [ms]"]).set_index("Proto")
def experiment_duration_inflation(protos, dfs, opt):
rows = [[proto.upper(),
dfs[proto].iloc[-1]["SendT"]/1000,
opt] for proto in protos]
return pd.DataFrame(rows,columns=["Proto","EXP_ACT [s]","EXP_OPT [s]"]).set_index("Proto")
def aggregated_statistics(dfs, key):
rows = [[proto.upper(),
df[key].quantile(0.01),
df[key].quantile(0.95),
df[key].quantile(0.99),
df[key].std(),
] for proto, df in dfs.items()]
return pd.DataFrame(rows,columns=["Proto","1%","95%","99%","STD"]).set_index("Proto")
This diff is collapsed.
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