Commit 7e068b69 authored by Andreas Schmidt's avatar Andreas Schmidt

Jitter analysis takes durations from xlap.yml.

parent fa84559d
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (16, 9)
plt.rcParams.update({'figure.autolayout': True})
from xlap.analyse.common import get_outlier_threshold, extract_durations
from xlap.analyse import box
# TODO: Refactor.
def _dn(x):
return x + "Time"
def _filter(x, durations, source):
return durations[x]["Source"] == source
def jitter_causes(df, export=False, file_name=None):
def jitter_causes(df, durations, export=False, file_name=None):
stats = df["EndToEndTime"].describe()
tresh = get_outlier_threshold(stats)
outliers = df[df["EndToEndTime"] > tresh]
threshold = get_outlier_threshold(stats)
outliers = df[df["EndToEndTime"] > threshold]
# TODO: Refactor lines out.
reasons = ["Send_D",
"PrrtTransmit_D",
"LinkTransmit_D",
"Submit_D",
"SenderIPC_D",
"SenderEnqueued_D",
# "EncodingTime",
"Enqueue_D",
"Decoding_D",
"HandlePacket_D",
"ReceiverIPC_D",
"Feedback_D"]
reasons = [d + "_D" for d in durations.keys()]
df_reasons = pd.DataFrame(index=outliers.index)
for r in reasons:
r_tresh = get_outlier_threshold(df[r].describe())
df_reasons[r] = 0
df_reasons[r] = outliers[outliers[r] > r_tresh].notnull()
for reason in reasons:
reason_threshold = get_outlier_threshold(df[reason].describe())
df_reasons[reason] = 0
df_reasons[reason] = outliers[outliers[reason] > reason_threshold].notnull()
df_sum = df_reasons.sum().sort_values(ascending=False)
ax = df_sum.plot.bar(x="Reason", y="Frequency", rot=45, grid=True, legend=False, color="black")
......@@ -52,7 +26,7 @@ def jitter_causes(df, export=False, file_name=None):
fig.set_size_inches(8, 3, forward=True)
if export:
fig.savefig(file_name)
print("Outliers:", len(outliers), ";", "Threshold[us]:", tresh)
print("Outliers:", len(outliers), ";", "Threshold[us]:", threshold)
def trace_jitter(df_filtered, export=False, file_name=None):
......@@ -66,6 +40,6 @@ def trace_jitter(df_filtered, export=False, file_name=None):
def prep(df, config):
columns = extract_durations(config)
df_filtered = df[columns]
return df_filtered
plt.rcParams["figure.figsize"] = (16, 9)
plt.rcParams.update({'figure.autolayout': True})
return df[extract_durations(config)]
......@@ -41,4 +41,4 @@ def main():
df = jitter.prep(df_data, config)
jitter.trace_jitter(df, **params1)
jitter.jitter_causes(df, **params2)
jitter.jitter_causes(df, config["durations"], **params2)
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