- 在方法上加profile装饰器,括号内为输出文件地址,在方法执行完成后会生成对应文件。
from odoo.tools import profile @profile('/test1.profile') def write(self, vals): return super(InheritMrpBomLine, self).write(vals)
- 生成xdot文件
gprof2dot -f pstats -o /prof.xdot /test1.profile
- 转换为dot文件
dot -Tdot /prof.xdot -o /prof.dot
- 使用在线网站转为图片:免费 DOT 到 PNG 在线转换器 (converter.app)
Odoo16 使用profile分析代码性能
最新推荐文章于 2024-07-14 18:35:17 发布