From: Christian Heller Date: Thu, 3 Dec 2020 01:17:53 +0000 (+0100) Subject: Add main thread profiling hint. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/add_free?a=commitdiff_plain;h=441cf8d41a223e9bcd702d4ccb41ae679e6fcae3;p=plomrogue2 Add main thread profiling hint. --- diff --git a/plomrogue/io.py b/plomrogue/io.py index 8110647..8cba18d 100644 --- a/plomrogue/io.py +++ b/plomrogue/io.py @@ -43,7 +43,18 @@ class GameIO(): via self.queue from connected servers' clients.""" self.queue = queue.Queue() + + # optionally use this for main thread profiling: + # import cProfile + # class ProfiledThread(threading.Thread): + # def run(self): + # profiler = cProfile.Profile() + # profiler.runcall(threading.Thread.run, self) + # print('profiled thread finished') + # profiler.dump_stats('profile') + # c = ProfiledThread(target=self.loop, args=(self.queue,)) c = threading.Thread(target=self.loop, args=(self.queue,)) + c.start() def start_server(self, port, server_class, certfile=None, keyfile=None):