Skip to content

Commit

Permalink
dividing logs and building charts for cpu and memory consumption
Browse files Browse the repository at this point in the history
  • Loading branch information
gckopper committed Sep 23, 2024
1 parent 79afbdc commit 0e60bc0
Show file tree
Hide file tree
Showing 93 changed files with 7,658 additions and 172 deletions.
43 changes: 14 additions & 29 deletions graphs/cpu.py → graphs/cpu-core-mono.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,16 @@

files = [
[
"../logs/oai/oai/iperf/cpu-ran.csv",
"../logs/srsran/oai/iperf/cpu-ran.csv",
"../logs/oai/oaicn/mono/cpu.csv",
"../logs/srsran/oaicn/mono/cpu.csv",
],
[
"../logs/oai/open5gs/iperf/cpu-ran.csv",
"../logs/srsran/open5gs/iperf/cpu-ran.csv",
"../logs/oai/open5gs/mono/cpu.csv",
"../logs/srsran/open5gs/mono/cpu.csv",
],
[
"../logs/oai/free5gc/iperf/cpu-ran.csv",
"../logs/srsran/free5gc/iperf/cpu-ran.csv",
],
]
# how many samples to skip until the start of the experiment
skip = [
[
15,
10,
],
[
19,
14,
],
[
14,
19,
"../logs/oai/free5gc/mono/cpu.csv",
"../logs/srsran/free5gc/mono/cpu.csv",
],
]

Expand All @@ -41,25 +26,25 @@
]

def conv(x):
return float(x[:-1])
return float(x)*100

def readfile(file: str, skip: int):
data = np.genfromtxt(file, delimiter=",", skip_header=skip, max_rows=40, usecols=[2], converters={2: conv})
def readfile(file: str):
data = np.genfromtxt(file, delimiter=",", max_rows=11, usecols=[2], converters={2: conv})
return data


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
x = np.arange(11) * 30 # the label locations

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)
for tests, ax, core in zip(files, axes, cores):
ax.set_ylim(0, 8)
for ran, color, test in zip(rans, colors, tests):
data = readfile(test)
rects = ax.plot(x, data, label=ran, color=color)
ax.set_xlabel(core, fontsize=12)

Expand Down
66 changes: 66 additions & 0 deletions graphs/cpu-core-split.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

files = [
[
"../logs/oai/oaicn/split/cpu.csv",
"../logs/srsran/oaicn/split/cpu.csv",
],
[
"../logs/oai/open5gs/split/cpu.csv",
"../logs/srsran/open5gs/split/cpu.csv",
],
[
"../logs/oai/free5gc/split/cpu.csv",
"../logs/srsran/free5gc/split/cpu.csv",
],
]

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

cores = [
"OAI CN",
"Open5GS",
"Free5GC",
]

def conv(x):
return float(x)*100

def readfile(file: str):
data = np.genfromtxt(file, delimiter=",", max_rows=11, usecols=[2], converters={2: conv})
return data


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

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

for tests, ax, core in zip(files, axes, cores):
ax.set_ylim(0, 8)
for ran, color, test in zip(rans, colors, tests):
data = readfile(test)
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('CPU Utilization (%)', fontsize=14)
#axes[len(axes)//2].set_xlabel("Tempo (s)", fontsize=14)
axes[-1].legend(loc='upper right', ncols=2, fontsize=12)
fig.supxlabel("Time (s)", fontsize=14)

#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()
66 changes: 66 additions & 0 deletions graphs/cpu-mono.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

files = [
[
"../logs/oai/oaicn/mono/cpu-gnb.csv",
"../logs/srsran/oaicn/mono/cpu-gnb.csv",
],
[
"../logs/oai/open5gs/mono/cpu-gnb.csv",
"../logs/srsran/open5gs/mono/cpu-gnb.csv",
],
[
"../logs/oai/free5gc/mono/cpu-gnb.csv",
"../logs/srsran/free5gc/mono/cpu-gnb.csv",
],
]

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

cores = [
"OAI CN",
"Open5GS",
"Free5GC",
]

def conv(x):
return float(x)*100

def readfile(file: str):
data = np.genfromtxt(file, delimiter=",", max_rows=11, usecols=[2], converters={2: conv})
return data


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

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

for tests, ax, core in zip(files, axes, cores):
ax.set_ylim(0, 16)
for ran, color, test in zip(rans, colors, tests):
data = readfile(test)
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('CPU Utilization (%)', fontsize=14)
#axes[len(axes)//2].set_xlabel("Tempo (s)", fontsize=14)
axes[-1].legend(loc='upper right', ncols=2, fontsize=12)
fig.supxlabel("Time (s)", fontsize=14)

#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()
66 changes: 66 additions & 0 deletions graphs/cpu-split-cu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

files = [
[
"../logs/oai/oaicn/split/cpu-cu.csv",
"../logs/srsran/oaicn/split/cpu-cu.csv",
],
[
"../logs/oai/open5gs/split/cpu-cu.csv",
"../logs/srsran/open5gs/split/cpu-cu.csv",
],
[
"../logs/oai/free5gc/split/cpu-cu.csv",
"../logs/srsran/free5gc/split/cpu-cu.csv",
],
]

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

cores = [
"OAI CN",
"Open5GS",
"Free5GC",
]

def conv(x):
return float(x)*100

def readfile(file: str):
data = np.genfromtxt(file, delimiter=",", max_rows=11, usecols=[2], converters={2: conv})
return data


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

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

for tests, ax, core in zip(files, axes, cores):
ax.set_ylim(0, 1)
for ran, color, test in zip(rans, colors, tests):
data = readfile(test)
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('CPU Utilization (%)', fontsize=14)
#axes[len(axes)//2].set_xlabel("Tempo (s)", fontsize=14)
axes[-1].legend(loc='upper right', ncols=2, fontsize=12)
fig.supxlabel("Time (s)", fontsize=14)

#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()
66 changes: 66 additions & 0 deletions graphs/cpu-split-du.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

files = [
[
"../logs/oai/oaicn/split/cpu-du.csv",
"../logs/srsran/oaicn/split/cpu-du.csv",
],
[
"../logs/oai/open5gs/split/cpu-du.csv",
"../logs/srsran/open5gs/split/cpu-du.csv",
],
[
"../logs/oai/free5gc/split/cpu-du.csv",
"../logs/srsran/free5gc/split/cpu-du.csv",
],
]

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

cores = [
"OAI CN",
"Open5GS",
"Free5GC",
]

def conv(x):
return float(x)*100

def readfile(file: str):
data = np.genfromtxt(file, delimiter=",", max_rows=11, usecols=[2], converters={2: conv})
return data


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

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

for tests, ax, core in zip(files, axes, cores):
ax.set_ylim(0, 16)
for ran, color, test in zip(rans, colors, tests):
data = readfile(test)
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('CPU Utilization (%)', fontsize=14)
#axes[len(axes)//2].set_xlabel("Tempo (s)", fontsize=14)
axes[-1].legend(loc='upper right', ncols=2, fontsize=12)
fig.supxlabel("Time (s)", fontsize=14)

#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()
51 changes: 51 additions & 0 deletions graphs/ram-core-mono.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

mpl.use('QtAgg')
files = [
"../logs/oai/oaicn/mono/mem.csv",
"../logs/oai/open5gs/mono/mem.csv",
"../logs/oai/free5gc/mono/mem.csv",
"../logs/srsran/oaicn/mono/mem.csv",
"../logs/srsran/open5gs/mono/mem.csv",
"../logs/srsran/free5gc/mono/mem.csv",
]
# how many samples to skip until the start of the experiment
labels = [
"OAI CN",
"Open5Gs",
"Free5Gc",
]

rans = ["OAI", "srsRAN"]

def conv(x):
return int(x)/1024/1024/1024

def readfile(file: str):
data = np.genfromtxt(file, delimiter=",", max_rows=11, usecols=[2], converters={2: conv})
return np.average(data)


x = np.arange(len(labels)) # the label locations
width = 0.33 # the width of the bars
multiplier = 0

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

for i in range(len(rans)):
offset = width * multiplier
data = (readfile(files[i]), readfile(files[i+2]), readfile(files[i+4]))
rects = ax.bar(x + offset, data, width, label=rans[i], color=colors[i])
ax.bar_label(rects, padding=2)
multiplier += 1

# Add some text for labels, title and custom x-axis tick labels, etc.
ax.set_ylabel('Comsumo de memória no núcleo (GB)', fontsize=14)
ax.set_xticks(x + width/2, labels, fontsize=12)
ax.set_ylim(0, 4)
ax.legend(loc='upper right', ncols=2, fontsize=12)

plt.show()
Loading

0 comments on commit 0e60bc0

Please sign in to comment.