데이터 10만개정도 처리하는데 세월아 네월아 하고있길래
아니도대체뭐가문제지 하고 구간마다 시간을 기록해서 더해서 합해서 어디서 차가막히는지 찾으려하는데
이걸 자주 반복하게되는 것 같아 이미 쓰던 디버깅에 도움을 주는 클래스를 좀 수정해 보았다
from datetime import datetime, timezone
import inspect
import time
def QDEBUG(comment, variable):
qDebug = DEBUGREPORT()
qDebug.GING = True
qDebug.report(comment, variable)
class DEBUGREPORT:
def __init__(self, GING=False, TEMP=False, timeCounterLabel=None):
self.GING = GING # variable name can be DEBUG so that expression as DEBUG.GING == True can be used
self.TEMP = TEMP
self.ERR = "FLAG_ERROR_DEBUGREPORT"
if timeCounterLabel == None:
timeCounterLabel = inspect.currentframe().f_back.f_lineno
self._timecounter = {timeCounterLabel: 0}
self._lastRecordedTime = time.perf_counter()
def timeMarker(self, flag_reset=False, timeCounterLabel=None):
if flag_reset:
self._timecounter = {}
if timeCounterLabel == None:
timeCounterLabel = inspect.currentframe().f_back.f_lineno
# Get the current frame, then the caller's frame
# Get the caller's line number
currentTime = time.perf_counter()
if timeCounterLabel in self._timecounter:
...




