| 119 | |
| 120 | |
| 121 | def 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 | |
| 140 | def main(): |