From 441cf8d41a223e9bcd702d4ccb41ae679e6fcae3 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 3 Dec 2020 02:17:53 +0100 Subject: [PATCH] Add main thread profiling hint. --- plomrogue/io.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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): -- 2.30.2