Skip to content

Commit

Permalink
better charts and better scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
gckopper committed Apr 3, 2024
1 parent 57f383e commit 9ea8f42
Show file tree
Hide file tree
Showing 14 changed files with 234 additions and 501 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
graphs/venv/
graphs/figs/
graphs/__pycache__/
15 changes: 15 additions & 0 deletions graphs/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import rtt
import ric
import ram
import cpu
import iperf
import ping
import retransmissions

rtt.build()
ric.build()
ram.build()
cpu.build()
iperf.build()
ping.build()
retransmissions.build()
43 changes: 26 additions & 17 deletions graphs/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import matplotlib.pyplot as plt
import matplotlib as mpl

mpl.use('QtAgg')
files = [
[
"../logs/oai/oai/iperf/cpu-ran.csv",
Expand Down Expand Up @@ -33,7 +32,7 @@
],
]

rans = ["OAI", "srsRAN"]
rans = ["OAI RAN", "srsRAN"]

cores = [
"OAI CN",
Expand All @@ -49,24 +48,34 @@ def readfile(file: str, skip: int):
return data


# there are 40 measurements total. They were taken every 15s
# so in total the test lasted 600s
x = np.arange(40) * 15 # the label locations
def build(save=True):
# there are 40 measurements total. They were taken every 15s
# so in total the test lasted 600s
x = np.arange(40) * 15 # the label locations

colors = ["#7EA16B", "#C3D898"]
fig, axes = plt.subplots(1, 3, layout='constrained')
colors = ["#7EA16B", "#C3D898"]
fig, axes = plt.subplots(1, 3, layout='constrained')

for tests, offsets, ax, core in zip(files, skip, axes, cores):
ax.set_ylim(0, 12)
for ran, color, test, offset in zip(rans, colors, tests, offsets):
data = readfile(test, offset)
rects = ax.plot(x, data, label=ran, color=color)
ax.set_xlabel(core, fontsize=12)
for tests, offsets, ax, core in zip(files, skip, axes, cores):
ax.set_ylim(0, 12)
for ran, color, test, offset in zip(rans, colors, tests, offsets):
data = readfile(test, offset)
rects = ax.plot(x, data, label=ran, color=color)
ax.set_xlabel(core, fontsize=12)

# Add some text for labels, title and custom x-axis tick labels, etc.
fig.supylabel('Consumo de CPU (%)', fontsize=14)
fig.supylabel('Consumo de CPU (%)', fontsize=14)
#axes[len(axes)//2].set_xlabel("Tempo (s)", fontsize=14)
axes[-1].legend(loc='upper right', ncols=2, fontsize=12)
fig.supxlabel("Tempo (s)", fontsize=14)
axes[-1].legend(loc='upper right', ncols=2, fontsize=12)
fig.supxlabel("Tempo (s)", fontsize=14)

plt.show()
#fig.set_tight_layout()
fig.set_size_inches(10.4, 4.2)
#plt.show()
if save:
fig.savefig("figs/cpu.pdf", dpi=100)

if __name__ == "__main__":
build(False)
mpl.use('QtAgg')
plt.show()
47 changes: 28 additions & 19 deletions graphs/iperf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import matplotlib as mpl
import json

mpl.use('QtAgg')
files = ["../logs/oai/oai/iperf/oai-oaicn",
"../logs/srsran/oai/iperf/20240304-oai",
"../logs/oai/open5gs/iperf/oai-open5gs",
Expand All @@ -18,39 +17,49 @@
"Free5Gc",
]
rans = [
"OAI",
"OAI RAN",
"srsRAN",
"_OAI",
"_srsRAN",
"_OAI",
"_srsRAN",
]
count = len(files)
ax = plt.subplot()
fig, ax = plt.subplots(1,1)

def conv(x):
return float(x['sum']['bits_per_second'])/1_000_000

def from_iter(x):
return np.fromiter(map(conv, x['intervals']), float)

ax.set_ylabel("Taxa de transferência (Mbps)", fontsize=14)
def build(save=True):
ax.set_ylabel("Taxa de Transferência (Mbps)", fontsize=16)

dataset = []
for i in range(count):
with open(files[i], "r") as file:
data = json.load(file)
dataset.append(list(from_iter(data)))
dataset = []
for i in range(count):
with open(files[i], "r") as file:
data = json.load(file)
dataset.append(list(from_iter(data)))

colors = ["#7EA16B", "#C3D898"]
b = ax.boxplot(dataset, labels=rans, medianprops={"color": "#000000"})
for i in range(len(b['boxes'])):
box = b['boxes'][i]
ax.add_patch(Polygon(box.get_xydata(), facecolor=colors[i%2], label=rans[i]))
colors = ["#7EA16B", "#C3D898"]
b = ax.boxplot(dataset, labels=rans, medianprops={"color": "#000000"})
for i in range(len(b['boxes'])):
box = b['boxes'][i]
ax.add_patch(Polygon(box.get_xydata(), facecolor=colors[i%2], label=rans[i]))

x = np.arange(len(labels)) * 2 + 1.5
ax.set_xticks(x, labels, fontsize=12)
ax.set_ylim((50,130))
ax.legend(loc='upper right', ncols=2, fontsize=12)
x = np.arange(len(labels)) * 2 + 1.5
ax.set_xticks(x, labels, fontsize=16)
ax.set_ylim((50,130))
ax.legend(loc='upper right', ncols=2, fontsize=14)

plt.show()
fig.set_size_inches(10.4, 4.2)
plt.tight_layout()
#plt.show()
if save:
fig.savefig("figs/iperf.pdf", dpi=100)

if __name__ == "__main__":
build(save=False)
mpl.use('QtAgg')
plt.show()
42 changes: 26 additions & 16 deletions graphs/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from matplotlib.patches import Polygon
import matplotlib as mpl

mpl.use('QtAgg')
NUM_ROWS = 600

def conv(x: str):
Expand All @@ -30,30 +29,41 @@ def read_file(path: str):
"Free5Gc",
]
rans = [
"OAI",
"OAI RAN",
"srsRAN",
"_OAI",
"_srsRAN",
"_OAI",
"_srsRAN",
]
count = len(paths)

ax = plt.subplot()
def build(save=True):
count = len(paths)

fig, ax = plt.subplots(1,1)

dataset = list(map(lambda path: read_file(path), paths))
ax.set_ylabel("Latência (ms)", fontsize=14)
ax.set_ylim((0, 64))
colors = ["#7EA16B", "#C3D898"]
b = ax.boxplot(dataset, labels=rans, medianprops={"color": "#000000"})
for i in range(len(b['boxes'])):
box = b['boxes'][i]
ax.add_patch(Polygon(box.get_xydata(), facecolor=colors[i%2], label=rans[i]))

x = np.arange(len(labels)) * 2 + 1.5
ax.set_xticks(x, labels, fontsize=12)
dataset = list(map(lambda path: read_file(path), paths))
ax.set_ylabel("Latência (ms)", fontsize=16)
ax.set_ylim((0, 64))
colors = ["#7EA16B", "#C3D898"]
b = ax.boxplot(dataset, labels=rans, medianprops={"color": "#000000"})
for i in range(len(b['boxes'])):
box = b['boxes'][i]
ax.add_patch(Polygon(box.get_xydata(), facecolor=colors[i%2], label=rans[i]))

ax.legend(loc='upper right', ncols=2, fontsize=12)
x = np.arange(len(labels)) * 2 + 1.5
ax.set_xticks(x, labels, fontsize=16)

plt.show()
ax.legend(loc='upper right', ncols=2, fontsize=14)

fig.set_size_inches(10.4, 4.2)
plt.tight_layout()
#plt.show()
if save:
fig.savefig("figs/ping.pdf", dpi=100)

if __name__ == "__main__":
build(False)
mpl.use('QtAgg')
plt.show()
86 changes: 0 additions & 86 deletions graphs/ram-boxplot.py

This file was deleted.

72 changes: 0 additions & 72 deletions graphs/ram-core-boxplot.py

This file was deleted.

Loading

0 comments on commit 9ea8f42

Please sign in to comment.