了解 spyder 的分析器结果 python

understanding spyder's profiler results python

我正在使用 python 2.7.11 和 spyder (v2.3.8) 分析器,但我无法理解结果。 这是按 "Total Time"

排序的结果的图像

我有 2 个问题:

1) mainloop 使用 216.012 总时间。我怎么知道我的代码 part/line 调用了那些函数?

2) 在函数 noise_kauff 中(我定义的)总时间是 20.51 但 noise_kauff 中的第一行使用 51.629?

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/

在您的示例中,大概 __getitem__ 运行 在 noise_kauff 内持续约 10 秒,加上在其他地方约半分钟。不幸的是,spyder 只是将它们加在一起 ​​- 这是一个已知的 issue/bug.