Browse Source

Profile

pull/9/head
Jure Šorn 5 years ago
parent
commit
bc8e2171cc
1 changed files with 3 additions and 2 deletions
  1. 5
      README.md

5
README.md

@ -1385,11 +1385,12 @@ def profiler(func):
def out(*args, **kwargs):
profile = Profile()
result = profile.runcall(func, *args, **kwargs)
with open(f'profile_{func.__name__}.txt', 'w') as stream:
filename = f'profile_{func.__name__}.txt'
with open(filename, 'w') as stream:
stats = Stats(profile, stream=stream)
stats.strip_dirs().sort_stats('tottime')
stats.print_stats(20)
print(f"Profile saved as 'profile_{func.__name__}.txt'")
print(f"Profile saved as '{filename}'")
return result
return out
```

Loading…
Cancel
Save