rename ops

This commit is contained in:
2026-03-09 18:37:36 +08:00
parent 563f480643
commit 82a845429b
10 changed files with 136 additions and 225 deletions
+13 -13
View File
@@ -18,7 +18,7 @@ def main() -> int:
parser.add_argument(
"--filter-errors",
action="store_true",
help="Only compare rows with error_ops == 0 (default: include all rows)",
help="Only compare rows with err_ops == 0 (default: include all rows)",
)
args = parser.parse_args()
@@ -32,9 +32,9 @@ def main() -> int:
"value_size",
"durability_mode",
"read_path",
"ops_per_sec",
"ops",
"p99_us",
"error_ops",
"err_ops",
}
missing = required - set(df.columns)
if missing:
@@ -50,45 +50,45 @@ def main() -> int:
]
if args.filter_errors:
base = df[df["error_ops"] == 0].copy()
base = df[df["err_ops"] == 0].copy()
else:
base = df.copy()
if base.empty:
if args.filter_errors:
print("No rows with error_ops == 0, cannot compare.")
print("No rows with err_ops == 0, cannot compare.")
else:
print("No rows found in csv, cannot compare.")
return 0
agg = base.groupby(keys + ["engine"], as_index=False).agg(
ops_per_sec=("ops_per_sec", "median"),
ops=("ops", "median"),
p99_us=("p99_us", "median"),
error_ops=("error_ops", "median"),
err_ops=("err_ops", "median"),
)
piv = agg.pivot_table(
index=keys,
columns="engine",
values=["ops_per_sec", "p99_us", "error_ops"],
values=["ops", "p99_us", "err_ops"],
aggfunc="first",
)
piv.columns = [f"{metric}_{engine}" for metric, engine in piv.columns]
out = piv.reset_index()
for col in [
"ops_per_sec_mace",
"ops_per_sec_rocksdb",
"ops_mace",
"ops_rocksdb",
"p99_us_mace",
"p99_us_rocksdb",
"error_ops_mace",
"error_ops_rocksdb",
"err_ops_mace",
"err_ops_rocksdb",
]:
if col not in out.columns:
out[col] = pd.NA
out["qps_ratio_mace_over_rocksdb"] = (
out["ops_per_sec_mace"] / out["ops_per_sec_rocksdb"]
out["ops_mace"] / out["ops_rocksdb"]
)
out["p99_ratio_mace_over_rocksdb"] = out["p99_us_mace"] / out["p99_us_rocksdb"]
out = out.sort_values(keys)
+4 -4
View File
@@ -180,7 +180,7 @@ def plot_results(
thread_points: Sequence[int],
) -> list[Path]:
df = pd.read_csv(result_csv)
required = {"engine", "mode", "threads", "key_size", "value_size", "ops_per_sec"}
required = {"engine", "mode", "threads", "key_size", "value_size", "ops"}
missing = required - set(df.columns)
if missing:
raise ValueError(f"Missing required columns in csv: {sorted(missing)}")
@@ -191,7 +191,7 @@ def plot_results(
grouped = (
df.groupby(["engine", "mode", "key_size", "value_size", "threads"], as_index=False)[
"ops_per_sec"
"ops"
]
.mean()
.sort_values(["engine", "mode", "key_size", "value_size", "threads"])
@@ -209,7 +209,7 @@ def plot_results(
continue
plt.figure(figsize=(16, 10))
y_max = float(mode_df["ops_per_sec"].max()) if not mode_df.empty else 0.0
y_max = float(mode_df["ops"].max()) if not mode_df.empty else 0.0
for engine in ENGINE_ORDER:
for key_size, value_size in KV_PROFILES:
@@ -222,7 +222,7 @@ def plot_results(
continue
x = sub["threads"].tolist()
y = sub["ops_per_sec"].tolist()
y = sub["ops"].tolist()
label = (
f"{engine} ({format_bytes(key_size)}/{format_bytes(value_size)})"
)
+4 -4
View File
@@ -25,7 +25,7 @@ def main() -> int:
"key_size",
"value_size",
"threads",
"ops_per_sec",
"ops",
"p99_us",
}
missing = needed - set(df.columns)
@@ -41,10 +41,10 @@ def main() -> int:
agg = (
sub.groupby(grp_cols)
.agg(
repeats=("ops_per_sec", "count"),
throughput_cv=("ops_per_sec", cv),
repeats=("ops", "count"),
throughput_cv=("ops", cv),
p99_cv=("p99_us", cv),
throughput_median=("ops_per_sec", "median"),
throughput_median=("ops", "median"),
p99_median=("p99_us", "median"),
)
.reset_index()
+3 -3
View File
@@ -32,7 +32,7 @@ def main() -> int:
"value_size",
"prefill_keys",
"threads",
"ops_per_sec",
"ops",
"p95_us",
"p99_us",
}
@@ -51,8 +51,8 @@ def main() -> int:
summary = (
sub.groupby(grp_cols)
.agg(
repeats=("ops_per_sec", "count"),
throughput_median=("ops_per_sec", "median"),
repeats=("ops", "count"),
throughput_median=("ops", "median"),
p95_median=("p95_us", "median"),
p99_median=("p99_us", "median"),
)
+3 -3
View File
@@ -17,7 +17,7 @@ def main() -> int:
"workload_id",
"threads",
"durability_mode",
"ops_per_sec",
"ops",
"p99_us",
}
missing = needed - set(df.columns)
@@ -39,8 +39,8 @@ def main() -> int:
base = (
sub.groupby(["engine", "workload_id", "threads", "durability_mode"])
.agg(
repeats=("ops_per_sec", "count"),
throughput_median=("ops_per_sec", "median"),
repeats=("ops", "count"),
throughput_median=("ops", "median"),
p99_median=("p99_us", "median"),
)
.reset_index()
+2 -2
View File
@@ -24,7 +24,7 @@ def main() -> int:
"threads",
"key_size",
"value_size",
"ops_per_sec",
"ops",
"p99_us",
}
missing = required - set(df.columns)
@@ -48,7 +48,7 @@ def main() -> int:
if sub.empty:
continue
for metric, ylabel in (("ops_per_sec", "OPS/s"), ("p99_us", "P99 Latency (us)")):
for metric, ylabel in (("ops", "OPS/s"), ("p99_us", "P99 Latency (us)")):
plt.figure(figsize=(12, 7))
for workload in sorted(sub["workload_id"].unique()):
wdf = sub[sub["workload_id"] == workload].sort_values("threads")