Q: How do I read the output of the IPython %prun (profiler) command? I run this:
In [303]: %prun my_function()
         384707 function calls (378009 primitive calls) in 83.116 CPU seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    37706   41.693    0.001   41.693    0.001 {max}
    20039   36.000    0.002   36.000    0.002 {min}
    18835    1.848    0.000    2.208    0.000 helper.py:119(fftfreq)

--snip--
What do each of tottime, percall, cumtime? ncalls is fairly obviously (number of times the function is called). My guess is that tottime is the total time spent in the function excluding time spent within its own function calls; percall is ???; cumtime is total time spent in the function call including time spent within its own function calls (but of course, excluding double counting). The docs are not too helpful; Google search doesn't help either.

A: It's just a convenient wrapper for Python's own profiler, the documentation for which is here:
http://docs.python.org/library/profile.html#module-pstats
Quoting:

ncalls
  for the number of calls,
tottime for the total time spent in the given function (and excluding time made in calls to sub-functions),
percall is the quotient of tottime divided by ncalls
cumtime is the total time spent in this and all subfunctions (from invocation till exit). This figure is accurate even for recursive
  functions.
percall is the quotient of cumtime divided by primitive calls

