developer tip

Python 스크립트를 프로파일 링 할 때 호출별로 cProfile 출력 정렬

copycodes 2020. 12. 5. 10:00
반응형

Python 스크립트를 프로파일 링 할 때 호출별로 cProfile 출력 정렬


나는 사용하고있다 python -m cProfile -s calls myscript.py

python -m cProfile -s percall myscript.py 작동하지 않습니다.

Python 문서에는 "유효한 정렬 값에 대해서는 Stats 문서를 참조하십시오 .": http://docs.python.org/library/profile.html#module-cProfile , 찾을 수 없습니다.


-s는 sort_stats 아래에있는 키만 사용 합니다.

calls (call count)
cumulative (cumulative time)
cumtime (cumulative time)
file (file name)
filename (file name)
module (file name)
ncalls (call count)
pcalls (primitive call count)
line (line number)
name (function name)
nfl (name/file/line)
stdname (standard name)
time (internal time)
tottime (internal time)

여기에 예가 있습니다.

python -m cProfile -s tottime myscript.py

참고 URL : https://stackoverflow.com/questions/10326936/sort-cprofile-output-by-percall-when-profiling-a-python-script

반응형