Python性能测试

python -m profile xxx.py > log.txt

打开log.txt查看,搜索你所关心的方法调用耗费的时间。

profile的统计结果分为ncalls、tottime、percall、cumtime、percall、filename:lineno(function)

ncalls函数的被调用次数

tottime函数总计运行时间,除去函数中调用的函数运行时间

percall函数运行一次的平均时间,等于tottime/ncalls

cumtime函数总计运行时间,含调用的函数运行时间

percall函数运行一次的平均时间,等于cumtime/ncalls

filename:lineno(function)函 数所在的文件名,函数的行号、函数名

posted @ 2015-02-02 09:45  我只吃大碗  阅读(339)  评论(0编辑  收藏  举报