Skip to content

Commit

Permalink
benchmarks: add grouped plot for ycsb-c
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Wünsche committed Apr 12, 2024
1 parent 4eb9ac5 commit 3907dbd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
12 changes: 11 additions & 1 deletion betree/haura-benchmarks/haura-plots/haura_plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ def main():
# Prep the color scheme
util.init_colormap()

ycsb_c = []

# Individual Plots
for path in sys.argv[1:]:
if os.path.isfile(path):
continue
with open(f"{path}/betree-metrics.jsonl", 'r', encoding="UTF-8") as metrics:
data = util.read_jsonl(metrics)
# Plot actions
Expand All @@ -275,8 +280,13 @@ def main():
plot_object_distribution(path)
metrics_plots.plot_system(path)
cache_plots.plot_cache(data, path)
ycsb_plots.plot_c(path)
ycsb_c.append(ycsb_plots.plot_c(path))
#plot_filesystem_test()

# Grouped Plots
for group in list({run["group"] for run in filter(lambda x: x is not None, ycsb_c)}):
ycsb_plots.plot_grouped_c(group, list(filter(lambda x: x["group"] == group, ycsb_c)))


if __name__ == "__main__":
main()
33 changes: 32 additions & 1 deletion betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import matplotlib.pyplot as plt

def plot_c(path):
"""
Bar chart for YCSB-C-esque scalability of a singular run.
"""
if not os.path.exists(f"{path}/ycsb_c.csv"):
return

Expand All @@ -20,7 +23,35 @@ def plot_c(path):
ax.plot(data["threads"], optimal_scaling, linestyle=":", label="Optimal", color='grey')
ax.bar(data["threads"], data["ops"] / (data["time_ns"] / 10**9))
ax.set_ylabel("Throughput [op/s]")
ax.set_title("YCSB-C Scaling Behavior")
ax.set_title(f"YCSB-C Scaling | {' | '.join(path.split('/')[-2:])}")
ax.set_xlabel("Threads [#]")
fig.legend()
fig.savefig(f"{path}/ycsb_c.svg")
return {
"title": path.split('/')[-1:][0],
"group": '/'.join(path.split('/')[:-1]),
"threads": data["threads"],
"results": data["ops"] / (data["time_ns"] / 10**9),
}

def plot_grouped_c(path, runs):
"""
Bar chart for YCSB-C-esque scalability over multiple runs.
"""
if not os.path.exists(path):
return

fig, ax = plt.subplots()
off = 1 / (len(runs) + 1)
for idx, run in enumerate(runs):
ax.bar(
[l - off * ((len(runs)-1)/2) + idx * off for l in run["threads"]],
run["results"],
off,
label=run["title"]
)

group = runs[0]["group"].split('/')[-1:][0]
ax.set_title(f'YCSB Scaling | {group}')
extra = fig.legend(loc="upper left", bbox_to_anchor=(0.9, 0.89))
fig.savefig(f"{path}/ycsb_c_comparison.svg", bbox_extra_artists=(extra,), bbox_inches="tight")

0 comments on commit 3907dbd

Please sign in to comment.