Browse Source

Profiling decorators

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

6
README.md

@ -1425,7 +1425,7 @@ with PyCallGraph(output=graph):
from timeit import default_timer from timeit import default_timer
from datetime import timedelta from datetime import timedelta
def stopwatch(func):
def time_me(func):
def out(*args, **kwargs): def out(*args, **kwargs):
start = default_timer() start = default_timer()
result = func(*args, **kwargs) result = func(*args, **kwargs)
@ -1440,7 +1440,7 @@ def stopwatch(func):
from cProfile import Profile from cProfile import Profile
from pstats import Stats from pstats import Stats
def profiler(func):
def profile_me(func):
def out(*args, **kwargs): def out(*args, **kwargs):
profile = Profile() profile = Profile()
result = profile.runcall(func, *args, **kwargs) result = profile.runcall(func, *args, **kwargs)
@ -1456,7 +1456,7 @@ def profiler(func):
#### Prints arguments and output of a decorated function: #### Prints arguments and output of a decorated function:
```python ```python
def tracer(func):
def trace_me(func):
def out(*args, **kwargs): def out(*args, **kwargs):
result = func(*args, **kwargs) result = func(*args, **kwargs)
arg_list = [repr(x) for x in args] arg_list = [repr(x) for x in args]

Loading…
Cancel
Save