I'm using cprofile and snakeviz to analyze some python code.
I'm getting weird results like this:
Two questions:
Given that the
cumtime
is supposed to include the runtime of the routine and all subroutines, and thetottime
is only the runtime of the routine itself - we would expect that thecumtime
will always be greater (and this is indeed the most common thing) - why is it different here? Is it related to the fact I'm heavily relying onnumpy
?what does the fractional
ncalls
mean? does it explain the oddcumtime
vs.tottime
behavior?
EDIT:
According to the snakeviz documentation, when there are two numbers in the ncalls
column that means the call is recursive. So perhaps the tottime includes only the time spent in the function not including calls to itself recursively, and the cumtime only consider primitive calls. But this is only a guess, will appreciate if someone can make a more definitive statement.