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

Function generate_summary

scripts/benchmark_throughput.py:121–137  ·  view source on GitHub ↗
(results)

Source from the content-addressed store, hash-verified

119
120
121def generate_summary(results):
122 summary_file = "result/throughput_log.csv"
123 os.makedirs("result", exist_ok=True)
124
125 df = pd.DataFrame(results)
126 # algo and cache size should be 1st and 2nd columns
127 column_order = ['algo', 'cache_size'] + [a for a in df.columns if a not in ['algo', 'cache_size']]
128 df = df.reindex(columns=column_order)
129 df.to_csv(summary_file, index=False)
130 logger.info(f"Summary saved to {summary_file}")
131
132 logger.info("Averaging out across all trace")
133 df = df.drop(columns=['trace'])
134 avg_df = df.groupby(['algo', 'cache_size']).mean().reset_index()
135 avg_df.to_csv("result/throughput_avg.csv", index=False)
136
137 logger.info(f"Average summary saved to result/throughput_avg.csv")
138
139
140def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected