Ask Your Question
0

How do I profile with %lprun in Cocalc?

asked 2017-08-04 17:23:54 +0200

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-08-04 18:25:09 +0200

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()
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-08-04 17:23:54 +0200

Seen: 257 times

Last updated: Aug 04 '17