tools: Sort timer results by time.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-04-18 17:13:44 +02:00
1 parent b56110d76b
commit c235bbebda
1 file changed
+13 -2
+13 -2
View File
@@ -24,8 +24,19 @@ def display_timers():
global _calls
print(" +---------------------------------------------------------Timers--+")
for func in _timers:
print(f" | {func:<32} | {_timers[func]:>10.6f} sec | {_calls[func]:>5} calls |")
lst = sorted(
map(
lambda f: (f, _timers[f], _calls[f]),
_timers
),
key=lambda f: f[1],
reverse = True
)
for func, time, calls in lst:
print(f" | {func:<32} | {time:>10.6f} sec | {calls:>5} calls |")
print(" +-----------------------------------------------------------------+")
def timer(func):