Skip to content

Commit

Permalink
benchmark: add trend lines to latency plots (#54)
Browse files Browse the repository at this point in the history
* benchmark: add trend lines to plots

* benchmark: close figure after use

* benchmark: sort sizes in-place
  • Loading branch information
jwuensche authored Feb 20, 2024
1 parent f13c07c commit c03dbf8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions betree/haura-benchmarks/haura-plots/haura_plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,20 @@ def plot_evaluation_latency(path, variant):
fig, ax = plt.subplots(1,1,figsize=(6,4))
reads = data[data['op'] == 'r']
writes = data[data['op'] == 'w']
ax.scatter(reads['size'], reads['latency_ns'], marker='x', label="read")
ax.scatter(writes['size'], writes['latency_ns'], marker='.', label="write")
if len(reads) > 0:
ax.scatter(reads['size'], reads['latency_ns'], marker='x', label="read")
size = reads['size'].to_numpy()
latency = reads['latency_ns'].to_numpy()
p = np.polynomial.Polynomial.fit(size, latency, 1)
size.sort()
ax.plot(size, p(size), linestyle=':', label='read trend', color='black')
if len(writes) > 0:
ax.scatter(writes['size'], writes['latency_ns'], marker='.', label="write")
size = writes['size'].to_numpy()
latency = writes['latency_ns'].to_numpy()
p = np.polynomial.Polynomial.fit(size, latency, 1)
size.sort()
ax.plot(size, p(size), linestyle='-.', label='write trend', color='black')
xticks = np.arange(0, 12 * 1024 * 1024 + 1, 2 * 1024 * 1024)
ax.set_xticks(xticks, [int(x / 1024) for x in xticks])
ax.set_xlabel("Size in KiB")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,4 @@ def plot_system(path):

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

0 comments on commit c03dbf8

Please sign in to comment.