def print_summary(): print() print() print("SUMMARY:") print() def simpleformatter(num): if num < 10: return str(round(num, 1)) else: try: return str(round(num)) except (ValueError, OverflowError): return "NaN" finaltimes = sorted(function_times.items(), key=lambda i: i[1]) besttime = finaltimes[0][1] names = [function.__name__ for function, _ in finaltimes] times = [time / besttime for _, time in finaltimes] terminal_bars.plot(names, times, 200, formatter=simpleformatter) print() print("Zoomed:") print() terminal_bars.plot(names, times, 200, formatter=simpleformatter, maximum=times[0]*20)
if sum(times) > MINTIME: break print() print() print() print() print("SUMMARY:") print() def simpleformatter(num): if num < 10: return str(round(num, 1)) else: return str(round(num)) finaltimes = sorted(function_times.items(), key=lambda i: i[1]) besttime = finaltimes[0][1] names = [function.__name__ for function, _ in finaltimes] times = [time / besttime for _, time in finaltimes] terminal_bars.plot(names, times, 100, formatter=simpleformatter) print() print("Zoomed:") print() terminal_bars.plot(names, times, 100, formatter=simpleformatter, maximum=times[0]*20)