我用 cprofile
得到重犯,但是 filename:lineno
仅列出文件名,但列出文件路径对于快速打开该路径会更有用。特别是如果不同层次结构中可能存在相同的模块名称。
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 3.922 display.py:599 (show)
有没有办法把它变成全路径?
最佳答案
我猜你用“pstats.Stats”类格式化输出,你有:
stats = Stats(profiler)
stats.strip_dirs() # remove this
关于Python cprofile文件名:lineno get full path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50731065/