How do I profile with %lprun in Cocalc?
Hi, I'm trying to profile using %lprun in Cocalc, but it says that the decorator is not defined. How do I import it?
Best wishes Isaia
add a comment
Hi, I'm trying to profile using %lprun in Cocalc, but it says that the decorator is not defined. How do I import it?
Best wishes Isaia
Found an alternative solution, this snippet does line profiling of f and of the function g called inside f
def f(a,b,c):
y=g(b,c)
return a,y
from line_profiler import LineProfiler
lp = LineProfiler()
lp.add_function(g)
lp_wrapper = lp(f)
s,t = lp_wrapper(a,b,c)
lp.print_stats()
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2017-08-04 17:23:54 +0100
Seen: 286 times
Last updated: Aug 04 '17