[IPython-user] how to use line_profiler, %lprun
Gary Pajer
gary.pajer@gmail....
Mon Feb 9 17:30:31 CST 2009
I can't figure out how to use %lprun.
kernprof from the os command line works fine.
I have the two set-up lines in ipy_user_conf.py
I have script, say:
def foo(a,b):
a=a+1
b+=1
return a+b
foo(1,2)
which is saved as test.py
I guessed
%lprun -f foo test.py
no, that's not it.
the docstring has "<expression>" in it, not
"<name-of-script-to-profile>", so maybe
%lprun -f foo import test
but that's not it either.
I added the @profile decorator. No, not yet
(although
%lprun test.py
does work with the decorator)
What's the right thing to do?
TIA,
gary
More information about the IPython-user
mailing list