David Blume commited on 2021-01-10 00:27:32
Showing 1 changed files, with 2 additions and 0 deletions.
... | ... |
@@ -8,6 +8,7 @@ License: MIT |
8 | 8 |
import cProfile |
9 | 9 |
import tempfile |
10 | 10 |
import pstats |
11 |
+import functools |
|
11 | 12 |
from typing import Union, Optional, Tuple, List, Callable |
12 | 13 |
|
13 | 14 |
|
... | ... |
@@ -20,6 +21,7 @@ def profile(sort: Union[Tuple, List, str]='cumulative', |
20 | 21 |
then it's the percentage of total lines. (Eg., .2 = 20%) |
21 | 22 |
Output goes to stdout if filename is None, otherwise to filename.""" |
22 | 23 |
def outer(fun: Callable) -> Callable: |
24 |
+ @functools.wraps(fun) |
|
23 | 25 |
def inner(*args, **kwargs): |
24 | 26 |
prof = cProfile.Profile() |
25 | 27 |
ret = prof.runcall(fun, *args, **kwargs) |
26 | 28 |