update
This commit is contained in:
+31
-9
@@ -1,28 +1,50 @@
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
from adjustText import adjust_text
|
||||
|
||||
def real_mode(m):
|
||||
if m == "mixed":
|
||||
return "mixed (70% read, 30% write)"
|
||||
return m
|
||||
|
||||
# 读取数据
|
||||
df = pd.read_csv("./x.csv")
|
||||
|
||||
# group by mode
|
||||
# 按 mode 分组
|
||||
modes = df["mode"].unique()
|
||||
|
||||
|
||||
for mode in modes:
|
||||
plt.figure(figsize=(12, 6))
|
||||
plt.figure(figsize=(16, 9))
|
||||
subset = df[df["mode"] == mode]
|
||||
|
||||
# group by key_size/value_size
|
||||
# 按 key_size/value_size 分组
|
||||
key_value_combinations = subset.groupby(["key_size", "value_size"])
|
||||
|
||||
texts = []
|
||||
for (key_size, value_size), group in key_value_combinations:
|
||||
label = f"key={key_size}B, val={value_size}B"
|
||||
plt.plot(group["threads"], group["ops"], marker="o", label=label)
|
||||
x = group["threads"]
|
||||
y = group["ops"]
|
||||
|
||||
plt.title(f"Performance: {mode.upper()}")
|
||||
plt.xlabel("Threads")
|
||||
plt.ylabel("OPS")
|
||||
plt.grid(True)
|
||||
# 绘制折线
|
||||
line, = plt.plot(x, y, marker="o", label=label)
|
||||
|
||||
# 添加文本标签
|
||||
for xi, yi, ops in zip(x, y, group["ops"]):
|
||||
texts.append(
|
||||
plt.text(xi, yi, f"{int(ops)}", color=line.get_color(), fontsize=12)
|
||||
)
|
||||
|
||||
# 自动调整文本位置
|
||||
adjust_text(texts, arrowprops=dict(arrowstyle="->", color='gray'))
|
||||
|
||||
# 设置图表样式
|
||||
plt.title(f"Performance: {real_mode(mode).upper()}", fontsize=16)
|
||||
plt.xlabel("Threads", fontsize=14)
|
||||
plt.ylabel("OPS", fontsize=14)
|
||||
plt.grid(True, linestyle="--", alpha=0.6)
|
||||
plt.legend()
|
||||
plt.tight_layout()
|
||||
plt.savefig(f"{mode}.png")
|
||||
plt.close()
|
||||
plt.close()
|
||||
+6
-4
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pushd .
|
||||
cd ..
|
||||
cargo build --release 1>/dev/null 2> /dev/null
|
||||
|
||||
@@ -21,7 +22,7 @@ function samples() {
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
./target/release/kv_bench --path /home/abby/mace_bench --threads $i --iterations 100000 --mode mixed --key-size ${kv_sz[j]} --value-size ${kv_sz[j+1]} --insert-ratio 70
|
||||
./target/release/kv_bench --path /home/abby/mace_bench --threads $i --iterations 100000 --mode mixed --key-size ${kv_sz[j]} --value-size ${kv_sz[j+1]} --insert-ratio 30
|
||||
if test $? -ne 0
|
||||
then
|
||||
exit 1
|
||||
@@ -30,6 +31,7 @@ function samples() {
|
||||
done
|
||||
}
|
||||
|
||||
echo mode,threads,key_size,value_size,insert_ratio,ops > x.csv
|
||||
samples 2>> x.csv
|
||||
|
||||
echo mode,threads,key_size,value_size,insert_ratio,ops > scripts/x.csv
|
||||
samples 2>> scripts/x.csv
|
||||
popd
|
||||
./bin/python plot.py
|
||||
|
||||
Reference in New Issue
Block a user