fixed test code and update compare script
This commit is contained in:
@@ -5,6 +5,70 @@ import sys
|
||||
import pandas as pd
|
||||
|
||||
|
||||
WORKLOAD_TEMPLATE = [
|
||||
("W1", "`W1` (95R/5U, uniform)"),
|
||||
("W2", "`W2` (95R/5U, zipf)"),
|
||||
("W3", "`W3` (50R/50U)"),
|
||||
("W4", "`W4` (5R/95U)"),
|
||||
("W5", "`W5` (70R/25U/5S)"),
|
||||
("W6", "`W6` (100% scan)"),
|
||||
]
|
||||
WORKLOAD_LABELS = dict(WORKLOAD_TEMPLATE)
|
||||
|
||||
|
||||
def format_ratio(v: object) -> str:
|
||||
if pd.isna(v):
|
||||
return "N/A"
|
||||
return f"**{float(v):.1f}x**"
|
||||
|
||||
|
||||
def print_workload_summary_table(out_df: pd.DataFrame) -> None:
|
||||
template_order = [workload_id for workload_id, _ in WORKLOAD_TEMPLATE]
|
||||
observed = sorted(
|
||||
out_df["workload_id"].dropna().astype(str).unique().tolist()
|
||||
)
|
||||
workload_order = template_order + [w for w in observed if w not in WORKLOAD_LABELS]
|
||||
|
||||
print("\nSummary table (template format):")
|
||||
print(
|
||||
"| Workload | Mace wins (ops) | ops median ratio (Mace/RocksDB) | "
|
||||
"Mace wins (p99) | p99 median ratio (Mace/RocksDB) |"
|
||||
)
|
||||
print("|---|---:|---:|---:|--:|")
|
||||
|
||||
for workload_id in workload_order:
|
||||
sub = out_df[out_df["workload_id"] == workload_id]
|
||||
|
||||
ops_ratio = (
|
||||
pd.to_numeric(
|
||||
sub["ops_ratio_mace_over_rocksdb"], errors="coerce"
|
||||
)
|
||||
.replace([float("inf"), float("-inf")], pd.NA)
|
||||
.dropna()
|
||||
)
|
||||
p99_ratio = (
|
||||
pd.to_numeric(
|
||||
sub["p99_ratio_mace_over_rocksdb"], errors="coerce"
|
||||
)
|
||||
.replace([float("inf"), float("-inf")], pd.NA)
|
||||
.dropna()
|
||||
)
|
||||
|
||||
ops_win = int((ops_ratio > 1.0).sum())
|
||||
p99_win = int((p99_ratio < 1.0).sum())
|
||||
ops_total = int(len(ops_ratio))
|
||||
p99_total = int(len(p99_ratio))
|
||||
ops_median = ops_ratio.median() if ops_total > 0 else pd.NA
|
||||
p99_median = p99_ratio.median() if p99_total > 0 else pd.NA
|
||||
|
||||
workload_label = WORKLOAD_LABELS.get(workload_id, f"`{workload_id}`")
|
||||
print(
|
||||
f"| {workload_label} | {ops_win} / {ops_total} | "
|
||||
f"{format_ratio(ops_median)} | {p99_win} / {p99_total} | "
|
||||
f"{format_ratio(p99_median)} |"
|
||||
)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Compare mace vs rocksdb from benchmark_results.csv"
|
||||
@@ -106,6 +170,7 @@ def main() -> int:
|
||||
print("\nInterpretation:")
|
||||
print("- ops_ratio_mace_over_rocksdb > 1: mace has higher throughput")
|
||||
print("- p99_ratio_mace_over_rocksdb < 1: mace has lower p99 latency")
|
||||
print_workload_summary_table(out)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user