-
-
Save akiross/910870cb1b1420f15c27500d72b552a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from line_profiler import LineProfiler | |
def do_profile(follow=[]): | |
def inner(func): | |
def profiled_func(*args, **kwargs): | |
try: | |
profiler = LineProfiler() | |
profiler.add_function(func) | |
for f in follow: | |
profiler.add_function(f) | |
profiler.enable_by_count() | |
return func(*args, **kwargs) | |
finally: | |
profiler.print_stats() | |
return profiled_func | |
return inner |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment