threading.py._release_save & socket.py.accept cpu时间
我正在创建一个应用程序,我希望尽可能地限制其资源占用。 我注意到我的应用程序在低负载下平均消耗 4% 的 CPU 使用率,尽管这并不一定意味着坏事,但我想知道这到底来自哪里。
我开始使用分析软件(yappi),虽然所有线程似乎都没有花费太多时间,但有两个例外:
name #n tsub ttot tavg
Thread 1402.. ../lib/python2.6/socket.py.accept:19 340 678.6799..
..bmit_listene 1402.. ..n2.6/threading.py._release_save:21 5032 932.8961..
这些方法/类是否已知为“资源密集型”? 您有与这些相关的任何绩效改进技巧吗?
谢谢,
杰伊
I'm creating an app of which I like to limit its resource footprint as much as possible.
I noticed my app is consuming by average 4% cpu usage on a low load and although that doesn't necessarily mean a bad thing, I was wondering where exactly this comes from.
I started to use a profiling software (yappi) and while all threads not seem to spend much time there are 2 exceptions:
name #n tsub ttot tavg
Thread 1402.. ../lib/python2.6/socket.py.accept:19 340 678.6799..
..bmit_listene 1402.. ..n2.6/threading.py._release_save:21 5032 932.8961..
Are these methods/classes known to be "resource intensive"?
Do you have any performance improving tips related to these?
Thanks,
Jay
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
分析器中阻塞调用的时间意义不大。当进行阻塞调用时,线程被挂起并且其他线程运行,当阻塞调用返回时,在其他线程中花费的时间也会添加到被调用函数的总时间中。请参阅:Yappi 的多线程统计
更新:v0.62 支持 CPU 时间分析,有效解决与阻塞函数的多线程分析相关的所有问题。
Timings for the blocking calls in profilers are not very meaningful. When a blocking call is made that thread is suspended and other threads run, when blocking call returns back the time spent in other threads is also added to the total time of the called function. See this: Multithreaded Statistics for Yappi
Update: v0.62 supports CPU time profiling which effectively solves all the problems related with multithreaded profiling of blocking functions.