Commit c235bbeb authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

tools: Sort timer results by time.

Showing with 13 additions and 2 deletions
+13 -2
...@@ -24,8 +24,19 @@ def display_timers(): ...@@ -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):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment