Skip to content

Commit

Permalink
benchmarks: latency plot use more markers
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Wünsche committed Feb 5, 2024
1 parent 9d3fd2d commit ca5e304
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions betree/haura-benchmarks/haura-plots/haura_plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,18 @@ def plot_evaluation_latency(path, variant):
data = pd.read_csv(f"{path}/evaluation_{variant}.csv");

fig, ax = plt.subplots(1,1,figsize=(6,4))
ax.scatter(data['size'][:5000], data['latency_ns'][:5000], marker='x')
reads = data[data['op'] == 'r']
writes = data[data['op'] == 'w']
ax.scatter(reads['size'], reads['latency_ns'], marker='x')
ax.scatter(writes['size'], writes['latency_ns'], marker='.')
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")
ax.set_ylabel("Latency in ns")
ax.set_yscale("log")
label=' | '.join(path.split('/')[-2:])
ax.set_title(f"Haura - {label}")
fig.savefig(f"{path}/evaluation_read.svg")
fig.savefig(f"{path}/evaluation_{variant}.svg")
plt.close(fig)

USAGE_HELP="""Please specify an input run directory. If you already completed \
Expand Down
4 changes: 2 additions & 2 deletions betree/haura-benchmarks/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn run_all(mode: Mode) -> Result<(), Box<dyn Error>> {
min_size,
max_size,
};
scientific_evaluation::run_read_write(client, config, 1.0)?;
scientific_evaluation::run_read_write(client, config, 1.0, "read")?;
control.database.write().sync()?;
}
Mode::EvaluationRW {
Expand All @@ -127,7 +127,7 @@ fn run_all(mode: Mode) -> Result<(), Box<dyn Error>> {
min_size,
max_size,
};
scientific_evaluation::run_read_write(client, config, ratio.clamp(0.0, 1.0))?;
scientific_evaluation::run_read_write(client, config, ratio.clamp(0.0, 1.0), "rw")?;
control.database.write().sync()?;
}
Mode::Zip {
Expand Down
3 changes: 2 additions & 1 deletion betree/haura-benchmarks/src/scientific_evaluation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub fn run_read_write(
mut client: Client,
config: EvaluationConfig,
rw: f64,
name: &str,
) -> Result<(), Box<dyn Error>> {
println!("running scientific_evaluation");
// Generate positions to read
Expand All @@ -64,7 +65,7 @@ pub fn run_read_write(
let f = std::fs::OpenOptions::new()
.write(true)
.create(true)
.open("evaluation_read_write.csv")?;
.open("evaluation_{name}.csv")?;
let mut w = std::io::BufWriter::new(f);
w.write_all(b"offset,size,latency_ns,op\n")?;
for (pos, len) in positions.iter().cycle() {
Expand Down

0 comments on commit ca5e304

Please sign in to comment.