mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
tools: Sort timer results by time.
This commit is contained in:
1 parent
b56110d76b
commit
c235bbebda
1 file changed
+13
-2
+13
-2
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user