pythonspyder

understanding spyder's profiler results Python


I'm using Python 2.7.11 and spyder's (v2.3.8) profiler, but I have trouble understanding the results. This is an image of the results ordered by "Total Time"

enter image description here

I have 2 questions:

  1. mainloop uses 216.012 Total Time. How can I know what part/line of my code is calling those functions?

  2. In the function noise_kauff (which I defined) Total Time is 20.51 but the first line inside noise_kauff uses 51.629?


Solution

  • Note that the time and call values shown by [spyder-profiler] are global to the execution of the program and not specific to a particular call. Because of this, some functions/methods may show longer times than their callers.

    http://sjara.github.io/spyder-profiler/

    In your example, presumably __getitem__ ran for about ten seconds from within noise_kauff plus for about half a minute from elsewhere. Unfortunately spyder just adds those together - it's a known issue/bug.