Unify benchmark op counters
This commit is contained in:
+19
-10
@@ -18,12 +18,21 @@ def main() -> int:
|
||||
parser.add_argument(
|
||||
"--filter-errors",
|
||||
action="store_true",
|
||||
help="Only compare rows with err_ops == 0 (default: include all rows)",
|
||||
help="Only compare rows with err_op == 0 (default: include all rows)",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
df = pd.read_csv(args.csv_path)
|
||||
|
||||
legacy_columns = {
|
||||
"total_ops": "total_op",
|
||||
"ok_ops": "ok_op",
|
||||
"err_ops": "err_op",
|
||||
}
|
||||
for legacy, current in legacy_columns.items():
|
||||
if legacy in df.columns and current not in df.columns:
|
||||
df = df.rename(columns={legacy: current})
|
||||
|
||||
required = {
|
||||
"engine",
|
||||
"workload_id",
|
||||
@@ -34,7 +43,7 @@ def main() -> int:
|
||||
"read_path",
|
||||
"ops",
|
||||
"p99_us",
|
||||
"err_ops",
|
||||
"err_op",
|
||||
}
|
||||
missing = required - set(df.columns)
|
||||
if missing:
|
||||
@@ -50,13 +59,13 @@ def main() -> int:
|
||||
]
|
||||
|
||||
if args.filter_errors:
|
||||
base = df[df["err_ops"] == 0].copy()
|
||||
base = df[df["err_op"] == 0].copy()
|
||||
else:
|
||||
base = df.copy()
|
||||
|
||||
if base.empty:
|
||||
if args.filter_errors:
|
||||
print("No rows with err_ops == 0, cannot compare.")
|
||||
print("No rows with err_op == 0, cannot compare.")
|
||||
else:
|
||||
print("No rows found in csv, cannot compare.")
|
||||
return 0
|
||||
@@ -64,13 +73,13 @@ def main() -> int:
|
||||
agg = base.groupby(keys + ["engine"], as_index=False).agg(
|
||||
ops=("ops", "median"),
|
||||
p99_us=("p99_us", "median"),
|
||||
err_ops=("err_ops", "median"),
|
||||
err_op=("err_op", "median"),
|
||||
)
|
||||
|
||||
piv = agg.pivot_table(
|
||||
index=keys,
|
||||
columns="engine",
|
||||
values=["ops", "p99_us", "err_ops"],
|
||||
values=["ops", "p99_us", "err_op"],
|
||||
aggfunc="first",
|
||||
)
|
||||
piv.columns = [f"{metric}_{engine}" for metric, engine in piv.columns]
|
||||
@@ -81,13 +90,13 @@ def main() -> int:
|
||||
"ops_rocksdb",
|
||||
"p99_us_mace",
|
||||
"p99_us_rocksdb",
|
||||
"err_ops_mace",
|
||||
"err_ops_rocksdb",
|
||||
"err_op_mace",
|
||||
"err_op_rocksdb",
|
||||
]:
|
||||
if col not in out.columns:
|
||||
out[col] = pd.NA
|
||||
|
||||
out["qps_ratio_mace_over_rocksdb"] = (
|
||||
out["ops_ratio_mace_over_rocksdb"] = (
|
||||
out["ops_mace"] / out["ops_rocksdb"]
|
||||
)
|
||||
out["p99_ratio_mace_over_rocksdb"] = out["p99_us_mace"] / out["p99_us_rocksdb"]
|
||||
@@ -95,7 +104,7 @@ def main() -> int:
|
||||
|
||||
print(out.to_string(index=False))
|
||||
print("\nInterpretation:")
|
||||
print("- qps_ratio_mace_over_rocksdb > 1: mace has higher throughput")
|
||||
print("- ops_ratio_mace_over_rocksdb > 1: mace has higher throughput")
|
||||
print("- p99_ratio_mace_over_rocksdb < 1: mace has lower p99 latency")
|
||||
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user