Skip to content

Commit dff0a7c

Browse files
authored
benchmark: add trend lines to latency plots (parcio#54)
* benchmark: add trend lines to plots * benchmark: close figure after use * benchmark: sort sizes in-place
1 parent 3f7a53e commit dff0a7c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

betree/haura-benchmarks/haura-plots/haura_plots/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,20 @@ def plot_evaluation_latency(path, variant):
218218
fig, ax = plt.subplots(1,1,figsize=(6,4))
219219
reads = data[data['op'] == 'r']
220220
writes = data[data['op'] == 'w']
221-
ax.scatter(reads['size'], reads['latency_ns'], marker='x', label="read")
222-
ax.scatter(writes['size'], writes['latency_ns'], marker='.', label="write")
221+
if len(reads) > 0:
222+
ax.scatter(reads['size'], reads['latency_ns'], marker='x', label="read")
223+
size = reads['size'].to_numpy()
224+
latency = reads['latency_ns'].to_numpy()
225+
p = np.polynomial.Polynomial.fit(size, latency, 1)
226+
size.sort()
227+
ax.plot(size, p(size), linestyle=':', label='read trend', color='black')
228+
if len(writes) > 0:
229+
ax.scatter(writes['size'], writes['latency_ns'], marker='.', label="write")
230+
size = writes['size'].to_numpy()
231+
latency = writes['latency_ns'].to_numpy()
232+
p = np.polynomial.Polynomial.fit(size, latency, 1)
233+
size.sort()
234+
ax.plot(size, p(size), linestyle='-.', label='write trend', color='black')
223235
xticks = np.arange(0, 12 * 1024 * 1024 + 1, 2 * 1024 * 1024)
224236
ax.set_xticks(xticks, [int(x / 1024) for x in xticks])
225237
ax.set_xlabel("Size in KiB")

betree/haura-benchmarks/haura-plots/haura_plots/metrics_plots.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,4 @@ def plot_system(path):
146146

147147
fig.tight_layout()
148148
fig.savefig(f"{path}/proc.svg")
149+
plt.close(fig)

0 commit comments

Comments
 (0)