MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / main

Function main

experiments/analyze_statistics.py:248–283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

246
247
248def main():
249 parser = argparse.ArgumentParser(description="Analyze results and plot branch coverage.")
250 parser.add_argument("project", help="Project name (e.g., libpng, curl)")
251 args = parser.parse_args()
252
253 project = args.project
254 statistics_dir = os.path.join(OTUPUT_DIR, project, "statistics")
255 os.makedirs(statistics_dir, exist_ok=True)
256
257 # 1. Process coverage
258 final_branches = process_coverage(project, statistics_dir)
259
260 # 2. Get seed statistics
261 seed_stats = analyze_seed_statistics(project)
262
263 # 3. Process logs for cost
264 cost_stats = analyze_log_directory(os.path.join(OTUPUT_DIR, project))
265
266 # 4. Save results to txt
267 cost_file_path = os.path.join(statistics_dir, "cost_info.txt")
268 with open(cost_file_path, "w", encoding='utf-8') as f:
269 for k, v in seed_stats.items():
270 f.write(f"{k}: {v}\n")
271
272 for k, v in cost_stats.items():
273 if "Cost" in k:
274 f.write(f"{k}: {v:.6f}\n")
275 else:
276 f.write(f"{k}: {v}\n")
277
278 f.write(f"Final Covered Branches: {final_branches}\n")
279
280 print(f"Statistics saved to {cost_file_path}")
281
282 # 5. Plot coverage growth curve
283 plot_coverage_growth(project, statistics_dir)
284
285if __name__ == "__main__":
286 main()

Callers 1

Calls 4

process_coverageFunction · 0.85
analyze_seed_statisticsFunction · 0.85
analyze_log_directoryFunction · 0.85
plot_coverage_growthFunction · 0.85

Tested by

no test coverage detected