KnightChaser / LiveCLICryptoPanel

Simple CLI-Based live update cryptocurrency panel, written as Python.
0 stars 0 forks source link

[LiveCryptoPanel_upbitAPI] Measure every data process time-based performance #13

Closed KnightChaser closed 3 years ago

KnightChaser commented 3 years ago

It would be better to measure the time by using related packages how long it takes to request data - processing - processing - print data each time. 매번 데이터 요청 - 처리 - 가공 - 출력하는데까지 얼마나 걸리는지를 관련 패키지를 이용해 시간을 측정하면 더 나을 것 같다

I think it will be helpful a program performance measuring perspective! 프로그램의 성능 측정 면에서 도움이 될 것 같음!

KnightChaser commented 3 years ago

reference

I found a way to measure performance using timeit package. timeit 패키지를 활용해 퍼포먼스를 측정하는 방법을 찾았다.

The way to use is very simple. 사용 방법은 매우 간단하다.

import timeit

# ....

startPerformanceMeasurement = timeit.default_timer()

#....

finishPerformanceMeasurement = timeit.default_timer()

#...

# runtime log
                print("==========================================================================================================================================================")
                print("업데이트 시각 : {} | 업데이트 횟수 : {:,} 회 | API Call 실패 : {:,} 회 | 기타 에러 : {:,} 회 | Uptime 비율 : {} % | {:.3f} sec/process"
                            .format(now.strftime('%Y년 %m월 %d일 %H시 %M분 %S초'), updateCycleCount, apiCallFailedCount, exceptionCount, uptimeRatio,
                                    finishPerformanceMeasurement - startPerformanceMeasurement))
                print("==========================================================================================================================================================")
                print("powered by UPBIT. created by LUMINOUS(blog.naver.com/agerio100 | agerio100@naver.com)")

#....

Accomplished! 해결 완료!