Skip to main content
 首页 » 编程设计

python之了解 spyder 的探查器结果 python

2025年04月02日14del

我正在使用 python 2.7.11 和 spyder (v2.3.8) 分析器,但我无法理解结果。 这是按“总时间”排序的结果图片

我有两个问题:

1) mainloop 使用 216.012 总时间。我怎么知道我的代码的哪一部分/哪一行调用了这些函数?

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 中运行了大约十秒钟,再加上从其他地方运行了大约半分钟。不幸的是,spyder 只是将它们加在一起——这是一个已知问题/错误。