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

Function plot_mini_simple

scripts/plot_appr_mrc.py:117–160  ·  view source on GitHub ↗
(out_files, plot_path)

Source from the content-addressed store, hash-verified

115 plot_shards_multirate(out_files, plot_path)
116
117def plot_mini_simple(out_files, plot_path):
118 plt.figure(figsize=(10,6))
119 for csv_file in out_files:
120 try:
121 data = pd.read_csv(csv_file)
122 except Exception as e:
123 print("Error reading MINI CSV:", csv_file, e)
124 continue
125 data.columns = [col.strip().lower() for col in data.columns]
126 if "cache size" not in data.columns or "miss ratio" not in data.columns:
127 print("Error: MINI CSV", csv_file, "is missing required columns.")
128 continue
129 try:
130 data["cache size"] = pd.to_numeric(data["cache size"], errors="coerce")
131 except Exception as e:
132 print("Error converting Cache Size in", csv_file, e)
133 continue
134 data = data.sort_values(by="cache size").dropna()
135 rate_label = os.path.splitext(os.path.basename(csv_file))[0].split("_")[-1]
136 color = PLOT_COLORS.pop(0) if PLOT_COLORS else None
137 plt.plot(data["cache size"], data["miss ratio"],
138 marker="o", linestyle="-", markersize=3, linewidth=1, alpha=0.8,
139 label=f"Rate {rate_label}", color=color)
140 plt.title("MINI Miss Ratio Curve (Integrated)")
141 plt.xlabel("Cache Size")
142 plt.ylabel("Miss Ratio")
143 plt.ylim(0,1)
144 plt.grid(True, linestyle="--", alpha=0.7)
145 max_val = 0
146 for f in out_files:
147 try:
148 df = pd.read_csv(f)
149 df.columns = [col.strip().lower() for col in df.columns]
150 m = df["cache size"].dropna().astype(float).max()
151 if m > max_val:
152 max_val = m
153 except:
154 continue
155 plt.xlim(left=0, right=max_val)
156 os.makedirs(os.path.dirname(plot_path), exist_ok=True)
157 plt.legend()
158 plt.savefig(plot_path)
159 plt.close()
160 print("Integrated MINI plot saved to", plot_path)
161
162def main():
163 parser = argparse.ArgumentParser(

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected