home · contact · privacy
Add main thread profiling hint.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 3 Dec 2020 01:17:53 +0000 (02:17 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 3 Dec 2020 01:17:53 +0000 (02:17 +0100)
plomrogue/io.py

index 8110647647b1a809692949220135cf7eb9c4679d..8cba18d7a483664047b3601890fec3df2c4490a9 100644 (file)
@@ -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):