From 3907dbd74703fd4b1495c6ee29fa8577c370c0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20W=C3=BCnsche?= Date: Fri, 12 Apr 2024 11:03:50 +0200 Subject: [PATCH] benchmarks: add grouped plot for ycsb-c --- .../haura-plots/haura_plots/__init__.py | 12 ++++++- .../haura-plots/haura_plots/ycsb_plots.py | 33 ++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/betree/haura-benchmarks/haura-plots/haura_plots/__init__.py b/betree/haura-benchmarks/haura-plots/haura_plots/__init__.py index 1aaa3222..45cf5253 100755 --- a/betree/haura-benchmarks/haura-plots/haura_plots/__init__.py +++ b/betree/haura-benchmarks/haura-plots/haura_plots/__init__.py @@ -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 @@ -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() diff --git a/betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py b/betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py index 7af652fd..9d9cd8d2 100644 --- a/betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py +++ b/betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py @@ -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 @@ -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")