mirror of https://gitlab.com/pamhyr/pamhyr2
tools: Sort timer results by time.
parent
b56110d76b
commit
c235bbebda
15
src/tools.py
15
src/tools.py
|
|
@ -24,8 +24,19 @@ def display_timers():
|
||||||
global _calls
|
global _calls
|
||||||
|
|
||||||
print(" +---------------------------------------------------------Timers--+")
|
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(" +-----------------------------------------------------------------+")
|
print(" +-----------------------------------------------------------------+")
|
||||||
|
|
||||||
def timer(func):
|
def timer(func):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue