Revision b134331f84aeaed5ea4c8f1cea5a7a760128385c authored by Mohamed Barakat on 11 March 2022, 08:23:45 UTC, committed by GitHub on 11 March 2022, 08:23:45 UTC
2 parent s ffbeb0c + 7c6b864
Raw File
gather_performance_data.py
#!/usr/bin/python3

import os
from pathlib import Path

cpu_times = {}
real_times = {}
for filename in Path(".").glob("**/performance.out"):
	package_name = os.path.basename(os.path.dirname(filename))
	print("read performance data for package", package_name)
	with open(filename) as file:
		cpu_time = file.readline()
		parts = cpu_time.split(" ")
		if len(parts) != 2:
			print(filename, "does not contain exactly two floats in the first line")
			continue
		total_cpu_time = round(float(parts[0]) + float(parts[1]), 2)
		cpu_times[package_name] = total_cpu_time
		real_time = file.readline()
		real_times[package_name] = float(real_time)

for key,value in cpu_times.items():
	with open(key + "_cpu_time.csv", "w") as file:
		file.write(key + "\n" + str(value))

for key,value in real_times.items():
	with open(key + "_real_time.csv", "w") as file:
		file.write(key + "\n" + str(value))
back to top