Enable benchmarks

main
Bob Mottram 2020-08-28 21:29:41 +01:00
parent 95fce30bb5
commit 9fc0c4b653
1 changed files with 13 additions and 14 deletions

View File

@ -1122,18 +1122,17 @@ class PubServer(BaseHTTPRequestHandler):
prevGetId: str, currGetId: str): prevGetId: str, currGetId: str):
"""Updates a dictionary containing how long each segment of GET takes """Updates a dictionary containing how long each segment of GET takes
""" """
if self.server.debug: timeDiff = int((time.time() - GETstartTime) * 1000)
timeDiff = int((time.time() - GETstartTime) * 1000) logEvent = False
logEvent = False if timeDiff > 100:
if timeDiff > 100: logEvent = True
logEvent = True if prevGetId:
if prevGetId: if GETtimings.get(prevGetId):
if GETtimings.get(prevGetId): timeDiff = int(timeDiff - int(GETtimings[prevGetId]))
timeDiff = int(timeDiff - int(GETtimings[prevGetId])) GETtimings[currGetId] = str(timeDiff)
GETtimings[currGetId].append(str(timeDiff)) if logEvent:
if logEvent: for Id, timeDiff in GETtimings.items():
for Id, timeDiff in GETtimings.items(): print('GET TIMING|' + Id + '|' + timeDiff)
print('GET TIMING|' + Id + '|' + timeDiff)
def _benchmarkPOSTtimings(self, POSTstartTime, POSTtimings: [], def _benchmarkPOSTtimings(self, POSTstartTime, POSTtimings: [],
postID: int): postID: int):
@ -1968,7 +1967,7 @@ class PubServer(BaseHTTPRequestHandler):
return return
self._benchmarkGETtimings(GETstartTime, GETtimings, self._benchmarkGETtimings(GETstartTime, GETtimings,
'show about screen done' 'show about screen done',
'robots txt') 'robots txt')
# if not authorized then show the login screen # if not authorized then show the login screen
@ -2598,7 +2597,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.GETbusy = True self.server.GETbusy = True
self._benchmarkGETtimings(GETstartTime, GETtimings, self._benchmarkGETtimings(GETstartTime, GETtimings,
'avatar background shown done' 'avatar background shown done',
'GET busy time') 'GET busy time')
if not self._permittedDir(self.path): if not self._permittedDir(self.path):