相关疑难解决方法(0)

这个cProfile结果是什么告诉我需要修复?

我想提高Python脚本的性能,并一直cProfile用于生成性能报告:

python -m cProfile -o chrX.prof ./bgchr.py ...args...
Run Code Online (Sandbox Code Playgroud)

chrX.prof用Python 打开了这个文件pstats并打印出统计信息:

Python 2.7 (r27:82500, Oct  5 2010, 00:24:22) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pstats
>>> p = pstats.Stats('chrX.prof')
>>> p.sort_stats('name')
>>> p.print_stats()                                                                                                                                                                                                                        
Sun Oct 10 00:37:30 2010    chrX.prof                                                                                                                                                                                                      

         8760583 function calls in 13.780 CPU seconds                                                                                                                                                                                      

   Ordered by: function name                                                                                                                                                                                                               

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)                                                                                                                                                                    
        1    0.000    0.000    0.000    0.000 {_locale.setlocale} …
Run Code Online (Sandbox Code Playgroud)

python profile performance profiling cprofile

12
推荐指数
1
解决办法
1万
查看次数

标签 统计

cprofile ×1

performance ×1

profile ×1

profiling ×1

python ×1