더북(TheBook)

다음 코드는 cProfile 모듈에 있는 Profile 객체를 인스턴스화하고 이 인스턴스의 runcall 메서드를 사용해 테스트 함수를 실행한다.

from cProfile import Profile

profiler = Profile()
profiler.runcall(test)