aoc2021/aoclib/performance.py
2021-11-21 13:04:32 +01:00

9 lines
266 B
Python

def print_execution_time(day, part, avg_time):
units = ['s', 'ms', 'μs', 'ns']
unit = 0
while avg_time < 1:
avg_time *= 1000
unit += 1
print("Average execution time for day %s part %s: %1.2f%s" % (day, part, avg_time, units[unit]))