Commit 3f105a08 authored by Sven Liefgen's avatar Sven Liefgen
Browse files

Display transport delay

parent 52c938e1
......@@ -5,7 +5,6 @@ import matplotlib.pyplot as plt
def multi_cdf(dfs, config, export=False, file_name="CDF.pdf", figsize= (4,4), cols=3, colors=None):
durations = extract_durations(config)
durations.remove("EndToEnd")
rows = int(math.ceil(len(durations) / cols))
items = len(durations)
......
......@@ -33,14 +33,12 @@ def trace_jitter(data_frame, config=None, threshold=None, export=False, file_nam
"""
Displays (and saves) a stacked boxplot of durations.
"""
print(data_frame)
data_frame = data_frame[[x + "_D" for x in extract_durations(config)]]
print(data_frame)
data_frame.to_csv("durations.csv")
if threshold is None:
threshold = get_outlier_threshold(data_frame["EndToEnd_D"].describe())
df_no_outliers = data_frame[data_frame["EndToEnd_D"] <= threshold]
print(df_no_outliers["Transport_D"])
ax, fig = box(df_no_outliers, (0, threshold), export, file_name, figsize)
fig.set_size_inches(figsize[0], figsize[1])
print("{} / {} are no outliers.".format(len(df_no_outliers), len(data_frame)))
......
......@@ -36,7 +36,7 @@ def extract_durations(config):
durations_send = [x for x in durations if durations[x]["Source"] == "sender"]
durations_recv = [x for x in durations if durations[x]["Source"] == "receiver"]
return ["EndToEnd", "Sender"] + durations_send + ["Receiver"] + durations_recv
return ["EndToEnd", "Transport", "Sender"] + durations_send + ["Receiver"] + durations_recv
def box(data_frame, xlim=None, export=False, file_name=None, figsize=(8, 4.5)):
......
import argparse
from xlap.parse import evaluate, parse_config
from xlap.parse import evaluate, parse_config, parse
import xlap.analyse.jitter as jitter
import xlap.analyse.latency as latency
tasks = {
"jitter": None,
"latency": None,
"capture": None
"capture": None,
"parse": None
}
......@@ -18,6 +19,7 @@ def main():
parser.add_argument("-f", "--files", dest="files", nargs=2, help="Sender and Receiver CSV")
parser.add_argument("-s", "--suffix", dest="suffix", help="Suffix for exported file")
parser.add_argument("-x", "--xlap", dest="xlap", default="xlap.yml", help="xlap.yml config file")
parser.add_argument("-k", "--kind", dest="kind", default=0)
args = parser.parse_args()
config = parse_config(args.xlap)
......@@ -49,11 +51,14 @@ def main():
else:
print(output)
elif command == "latency":
df_data = evaluate(data_files["sender"], data_files["receiver"], config=config, kind=0)
df_data = evaluate(data_files["sender"], data_files["receiver"], config=config, kind=args.kind)
a = latency.analyse(df_data, config)
print(a.corr.sort_values(ascending=False))
elif command == "parse":
df_data = parse(data_files["sender"], data_files["receiver"], config=config, kind=args.kind)
df_data.to_csv(data_files["sender"].replace("sender", "combined"))
else:
df_data = evaluate(data_files["sender"], data_files["receiver"], config=config, kind=0)
df_data = evaluate(data_files["sender"], data_files["receiver"], config=config, kind=args.kind)
params = {"export": args.export}
......
......@@ -38,7 +38,6 @@ def _evaluate_file(file_name, stamps, kind, measured_column, sender=False):
print("{}: ignored {} of {} packets due to missing timestamps.".format(file_name, total-filtered, total))
return res
def _diff_t_c(df, start, stop):
time = df[stop + "_T"] - df[start + "_T"]
cycles = (df[stop + "_C"] - df[start + "_C"])
......@@ -86,11 +85,31 @@ def evaluate_side(file, config, side="sender", kind=0):
return df
def parse(sender_file, receiver_file, config, kind=0):
stamps = config["stamps"]
df1 = _evaluate_file(sender_file, stamps, kind, _stamp_name_by_src_and_type(stamps, "sender", kind=["time"])[1], True)
df2 = _evaluate_file(receiver_file, stamps, kind, _stamp_name_by_src_and_type(stamps, "receiver", kind=["time"])[1])
df = df1.join(df2)
tr = config["time_reference"]
cr = config["cycle_reference"]
for src in config["threads"]:
_generate_thread_durations(df, cr, src, stamps)
_generate_durations(df, config)
df["Sender_D"] = df[tr["sender"]["Stop"] + "_T"] - df[tr["sender"]["Start"] + "_T"]
df["Receiver_D"] = df[tr["receiver"]["Stop"] + "_T"] - df[tr["receiver"]["Start"] + "_T"]
df["EndToEnd_D"] = df[tr["receiver"]["Stop"] + "_T"] - df[tr["sender"]["Start"] + "_T"]
return df
def evaluate(sender_file, receiver_file, config, kind=0):
stamps = config["stamps"]
df1 = _evaluate_file(sender_file, stamps, kind, _stamp_name_by_src_and_type(stamps, "sender", kind=["time"])[0], True)
df2 = _evaluate_file(receiver_file, stamps, kind, _stamp_name_by_src_and_type(stamps, "receiver", kind=["time"])[0])
df1 = _evaluate_file(sender_file, stamps, kind, _stamp_name_by_src_and_type(stamps, "sender", kind=["time"])[1], True)
df2 = _evaluate_file(receiver_file, stamps, kind, _stamp_name_by_src_and_type(stamps, "receiver", kind=["time"])[1])
df = df1.join(df2)
tr = config["time_reference"]
......@@ -100,8 +119,8 @@ def evaluate(sender_file, receiver_file, config, kind=0):
df["Transport_D"] = df[tr["receiver"]["Start"] + "_T"] - df[tr["sender"]["Stop"] + "_T"]
# Correlate Receiver Timestamps with Sender Timestamps (subtracting Channel Duration)
for s in _stamp_name_by_src_and_type(stamps, "receiver", kind=["time"]):
df[s + "_T"] -= df["Transport_D"]
# for s in _stamp_name_by_src_and_type(stamps, "receiver", kind=["time"]):
# df[s + "_T"] -= df["Transport_D"]
for src in config["threads"]:
_generate_thread_durations(df, cr, src, stamps)
......
Supports Markdown
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