MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / plot_mini_multirate

Function plot_mini_multirate

scripts/plot_appr_mrc.py:83–111  ·  view source on GitHub ↗
(csv_path, plot_path)

Source from the content-addressed store, hash-verified

81 print("Integrated SHARDS plot saved to", plot_path)
82
83def 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
113def plot_shards_simple(out_files, plot_path):
114 # In simple-rate mode, integrate CSVs similarly.

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected