I was studying examples from the profile documentation , and I came to a workflow when I started
import cProfile as profile
import pstats
pr = profile.Profile()
pr.runcall(myFunc, args, kwargs)
st = pstats.Stats(pr)
st.print_stats()
This gives me general statistics on the number of calls made, etc. Keep in mind that it is quite mysterious: I use the numpyinside myFunc(for example numpy.sum, *and the like) numpy), but I can not find these calls in the object statistics. What I would like to see is the time spent on each line of the source code of the function myFunc. How to do it?
source
share