python에서 로거를 만든다거나 할때 코드의 시간을 측정하고 싶을때가 있다.
이때 python에서 기본으로 제공하는 time 모듈을 사용해보자
perf_counter
- perf_counter
- 전체 소요 시간
t0 = time.perf_counter()
recolorize_main()
t1 = time.perf_counter()
print("%.3f seconds" % (t1-t0))
process_time
- process_time
- CPU 소요시간 sleep 은 제외
t0 = time.process_time()
recolorize_main()
t1 = time.process_time()
print("%.3f seconds" % (t1-t0))