[英]Python profile results - Cumulative time of subfunctions doesn't add up to time of function
I am using python profiler for my project. 我正在为我的项目使用python profiler。 Following is the snippet of the report with print_callees stat output. 以下是带有print_callees stat输出的报告的摘要。
As can be seen in attached image, total cumulative time taken by ProcessCmd function is 12.893 seconds, but if I try to add the time taken by all subfunctions of ProcessCmd, it adds to 6.927 seconds. 如所附图像所示,ProcessCmd函数花费的总累积时间为12.893秒,但是如果我尝试将ProcessCmd的所有子功能所花费的时间相加,则总计为6.927秒。
I am having a hard time to figure out where is rest of 6 seconds being spent (12.893-6.837 = 6.056). 我很难弄清楚剩下的6秒花在哪里了(12.893-6.837 = 6.056)。
Am I missing something here? 我在这里想念什么吗?
It is likely spent inside the function itself. 它可能花费在函数本身内部。 Also keep in mind that things like operators (eg a+b) can have complex behaviour in Python, and it will not show up as a function call even though it may call __add__
functions on objects under the hood. 还要记住,像运算符(例如a + b)之类的东西在Python中可能具有复杂的行为,即使它可能在__add__
对象上调用__add__
函数,也不会显示为函数调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.