瀏覽代碼

Adds DL_bandwidth to plot.

master
langspielplatte 2 年之前
父節點
當前提交
861c764d75
共有 1 個檔案被更改,包括 24 行新增0 行删除
  1. +24
    -0
      plot_single_transmission_timeline.py

+ 24
- 0
plot_single_transmission_timeline.py 查看文件

@@ -10,6 +10,23 @@ import pandas as pd
import matplotlib.pyplot as plt


def convert_bandwidth(value):
if value == 0:
return 1.4
elif value == 1:
return 3
elif value == 2:
return 5
elif value == 3:
return 10
elif value == 4:
return 15
elif value == 5:
return 20
else:
return 0


if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("-s", "--serial_file", required=True, help="Serial csv file.")
@@ -49,7 +66,9 @@ if __name__ == "__main__":
transmission_df = pd.read_csv(
"{}{}".format(args.pcap_csv_folder, csv),
dtype=dict(is_retranmission=bool, is_dup_ack=bool),
converters={"UL_bandwidth": convert_bandwidth, "DL_bandwidth": convert_bandwidth},
)

transmission_df["datetime"] = pd.to_datetime(transmission_df["datetime"]) - pd.Timedelta(hours=1)
transmission_df = transmission_df.set_index("datetime")
transmission_df.index = pd.to_datetime(transmission_df.index)
@@ -102,10 +121,12 @@ if __name__ == "__main__":
twin1 = ax.twinx()
twin2 = ax.twinx()
twin3 = ax.twinx()
twin4 = ax.twinx()
# Offset the right spine of twin2. The ticks and label have already been
# placed on the right by twinx above.
twin2.spines.right.set_position(("axes", 1.1))
twin3.spines.right.set_position(("axes", 1.2))
twin4.spines.right.set_position(("axes", 1.3))


# create list fo color indices
@@ -135,18 +156,21 @@ if __name__ == "__main__":
p3, = twin2.plot(transmission_df["srtt"].dropna(), color="red", linestyle="dashdot", label="sRTT")
p1, = ax.plot(transmission_df["goodput_rolling"], color="blue", linestyle="solid", label="goodput")
p2, = twin1.plot(transmission_df["downlink_cqi"].dropna(), color="magenta", linestyle="dotted", label="CQI")
p5, = twin4.plot(transmission_df["DL_bandwidth"].dropna(), color="peru", linestyle="dotted", label="DL_bandwidth")

ax.set_xlim(transmission_df["index"].min(), transmission_df["index"].max())
ax.set_ylim(0, 500)
twin1.set_ylim(0, 15)
twin2.set_ylim(0, 0.2) #twin2.set_ylim(0, transmission_df["ack_rtt"].max())
twin3.set_ylim(0, transmission_df["snd_cwnd"].max() + 10)
twin4.set_ylim(0, 21)

ax.set_xlabel("arrival time")
ax.set_ylabel("Goodput [mbps]")
twin1.set_ylabel("CQI")
twin2.set_ylabel("sRTT [s]")
twin3.set_ylabel("cwnd")
twin4.set_ylabel("DL_bandwidth")

ax.yaxis.label.set_color(p1.get_color())
twin1.yaxis.label.set_color(p2.get_color())

Loading…
取消
儲存