Skip to content

Commit

Permalink
benchmark: add ycsb-c-esque plot
Browse files Browse the repository at this point in the history
  • Loading branch information
jwuensche committed Apr 9, 2024
1 parent 6da8935 commit 2a58dcb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions betree/haura-benchmarks/haura-plots/haura_plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from . import util
from . import metrics_plots
from . import cache_plots
from . import ycsb_plots

def sort_by_o_id(key):
"""
Expand Down Expand Up @@ -274,6 +275,7 @@ def main():
plot_object_distribution(path)
metrics_plots.plot_system(path)
cache_plots.plot_cache(data, path)
ycsb_plots.plot_c(path)
#plot_filesystem_test()

if __name__ == "__main__":
Expand Down
23 changes: 23 additions & 0 deletions betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
import pandas as pd
import matplotlib.pyplot as plt

def plot_c(path):
if not os.path.exists(f"{path}/ycsb_c.csv"):
return

data = pd.read_csv(f"{path}/ycsb_c.csv");
fig, ax = plt.subplots()
# op / s
first = data["ops"][0] / (data["time_ns"][0] / 10**9)
second = data["ops"][1] / (data["time_ns"][1] / 10**9)
if first < second / 2:
first = second / 2
optimal_scaling = [x * first for x in data["threads"]]
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_xlabel("Threads [#]")
fig.legend()
fig.savefig(f"{path}/ycsb_c.svg")
3 changes: 2 additions & 1 deletion betree/haura-benchmarks/src/ycsb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ pub fn c(mut client: KvClient, size: u64, threads: usize, runtime: u64) {
total += t.join().unwrap();
}
let end = start.elapsed();
w.write_fmt(format_args!("{workers},{total},{}", end.as_nanos()))
w.write_fmt(format_args!("{workers},{total},{}\n", end.as_nanos()))
.unwrap();
w.flush().unwrap();
println!("Achieved: {} ops/sec", total as f32 / end.as_secs_f32());
println!(" {} ns avg", end.as_nanos() / total);
}
Expand Down

0 comments on commit 2a58dcb

Please sign in to comment.