From 9fc0c4b6534625ecb3b7b2a145e709140b5925b0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 28 Aug 2020 21:29:41 +0100 Subject: [PATCH] Enable benchmarks --- daemon.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/daemon.py b/daemon.py index f39ad662c..0347b9ad5 100644 --- a/daemon.py +++ b/daemon.py @@ -1122,18 +1122,17 @@ class PubServer(BaseHTTPRequestHandler): prevGetId: str, currGetId: str): """Updates a dictionary containing how long each segment of GET takes """ - if self.server.debug: - timeDiff = int((time.time() - GETstartTime) * 1000) - logEvent = False - if timeDiff > 100: - logEvent = True - if prevGetId: - if GETtimings.get(prevGetId): - timeDiff = int(timeDiff - int(GETtimings[prevGetId])) - GETtimings[currGetId].append(str(timeDiff)) - if logEvent: - for Id, timeDiff in GETtimings.items(): - print('GET TIMING|' + Id + '|' + timeDiff) + timeDiff = int((time.time() - GETstartTime) * 1000) + logEvent = False + if timeDiff > 100: + logEvent = True + if prevGetId: + if GETtimings.get(prevGetId): + timeDiff = int(timeDiff - int(GETtimings[prevGetId])) + GETtimings[currGetId] = str(timeDiff) + if logEvent: + for Id, timeDiff in GETtimings.items(): + print('GET TIMING|' + Id + '|' + timeDiff) def _benchmarkPOSTtimings(self, POSTstartTime, POSTtimings: [], postID: int): @@ -1968,7 +1967,7 @@ class PubServer(BaseHTTPRequestHandler): return self._benchmarkGETtimings(GETstartTime, GETtimings, - 'show about screen done' + 'show about screen done', 'robots txt') # if not authorized then show the login screen @@ -2598,7 +2597,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.GETbusy = True self._benchmarkGETtimings(GETstartTime, GETtimings, - 'avatar background shown done' + 'avatar background shown done', 'GET busy time') if not self._permittedDir(self.path):