| 81 | print("Integrated SHARDS plot saved to", plot_path) |
| 82 | |
| 83 | def plot_mini_multirate(csv_path, plot_path): |
| 84 | try: |
| 85 | data = pd.read_csv(csv_path) |
| 86 | except Exception as e: |
| 87 | print("Error reading MINI CSV:", e) |
| 88 | sys.exit(1) |
| 89 | data.columns = [col.strip().lower() for col in data.columns] |
| 90 | if "cache size" not in data.columns or "miss ratio" not in data.columns: |
| 91 | print("Error: MINI CSV missing required columns.") |
| 92 | sys.exit(1) |
| 93 | try: |
| 94 | data["cache size"] = pd.to_numeric(data["cache size"], errors="coerce") |
| 95 | except Exception as e: |
| 96 | print("Error converting Cache Size:", e) |
| 97 | sys.exit(1) |
| 98 | data = data.sort_values(by="cache size").dropna() |
| 99 | plt.figure(figsize=(10,6)) |
| 100 | plt.plot(data["cache size"], data["miss ratio"], |
| 101 | marker="o", linestyle="-", markersize=3, linewidth=1, alpha=0.8) |
| 102 | plt.title("MINI Miss Ratio Curve (Multi-rate)") |
| 103 | plt.xlabel("Cache Size") |
| 104 | plt.ylabel("Miss Ratio") |
| 105 | plt.ylim(0,1) |
| 106 | plt.grid(True, linestyle="--", alpha=0.7) |
| 107 | plt.xlim(left=0, right=data["cache size"].max()) |
| 108 | os.makedirs(os.path.dirname(plot_path), exist_ok=True) |
| 109 | plt.savefig(plot_path) |
| 110 | plt.close() |
| 111 | print("MINI multi-rate plot saved to", plot_path) |
| 112 | |
| 113 | def plot_shards_simple(out_files, plot_path): |
| 114 | # In simple-rate mode, integrate CSVs similarly. |