title: Python profiling: time spent on each line of function
body: <p>I have been studying examples from the <a href="https://docs.python.org/2/library/profile.html" rel="noreferrer">profile documentation </a> and I have come to the workflow when I run</p>
  
  <pre><code>import cProfile as profile
  import pstats
  
  pr = profile.Profile()
  pr.runcall(myFunc, args, kwargs)
  
  st = pstats.Stats(pr)
  st.print_stats() # and other methods like print_callees, print_callers, etc.
  </code></pre>
  
  <p>This gives me some general stats of the number of calls made and so on. Mind you, it is rather cryptic: I heaviliy use <code>numpy</code> inside <code>myFunc</code> (like <code>numpy.sum</code>, <code>*</code> and the like) but I cannot find those calls in the stats object. What I would like to see is the time spent on each line of the source code of function <code>myFunc</code>. How do I do that?</p>