繁体   English   中英

PyGTK:分析后,gtk.main() 花费的时间比预期的要多,我怎么知道这是否合理?

[英]PyGTK: upon profiling, gtk.main() takes more time than expected, how do I know if this is reasonable?

我的程序是一个不断更新显示的可视化工具。 我正在尝试对其进行优化以提高帧率,而我最大的成本是 gtk._gtk.main:

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    9.159    9.159   45.476   45.476 {gtk._gtk.main}
      868    8.146    0.009    9.884    0.011 xyz.py:291(gfx_transform_queue)
      868    7.705    0.009   12.657    0.015 xyz.py:322(gfx_draw_queue)
      868    3.886    0.004    7.755    0.009 xyz.py:240(gfx_queue_atoms)
   868000    2.638    0.000    4.952    0.000 xyz.py:365(gfx_draw_circle)
  7027010    2.111    0.000    2.111    0.000 xyz.py:314(cmp_queue)
  1736000    2.015    0.000    2.015    0.000 {method 'draw_arc' of 'gtk.gdk.Drawable' objects}
   869844    1.728    0.000    1.728    0.000 {numpy.core._dotblas.dot}
      868    1.635    0.002    3.746    0.004 {sorted}
   869872    1.261    0.000    1.261    0.000 {numpy.core.multiarray.array}
      933    1.100    0.001    1.100    0.001 {method 'get_pointer' of 'gtk.gdk.Window' objects}

这是合理的行为,还是我做错了什么让 gtk.main 花费了很多时间?

您对分析数据的解释是错误的。 gtk.main() 实际上只是在用户与之交互时运行您的程序。 您所看到的是运行程序需要时间,而不是 gtk.main() 本身。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM