From 76ecfa5f69429371167cdaf3e4e3a24d8ee77ac3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 24 Jul 2017 13:44:05 +0100 Subject: bitbake: cooker/process: Drop server_main function Now that there is only one server, this abstraction is no longer needed and causes indrection/confusion. The server shutdown is also broken with the cooker post_server calls happening too late, leading to "lock held" warnings in the logs if PRServ is enabled. Remove the abstraction and put the shutdown calls in the right order with respect to the locking. (Bitbake rev: c0ddde7cf680225127d6285685652b905ed176c3) Signed-off-by: Richard Purdie --- bitbake/lib/bb/server/process.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'bitbake/lib/bb/server') diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 01d9f2f014..85beaae014 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py @@ -103,9 +103,27 @@ class ProcessServer(multiprocessing.Process): except: pass - bb.cooker.server_main(self.cooker, self.main) + if self.cooker.configuration.profile: + try: + import cProfile as profile + except: + import profile + prof = profile.Profile() + + ret = profile.Profile.runcall(prof, self.main) + + prof.dump_stats("profile.log") + bb.utils.process_profilelog("profile.log") + print("Raw profiling information saved to profile.log and processed statistics to profile.log.processed") + + else: + ret = self.main() + + return ret def main(self): + self.cooker.pre_serve() + bb.utils.set_process_name("Cooker") ready = [] @@ -184,6 +202,8 @@ class ProcessServer(multiprocessing.Process): except: pass + self.cooker.post_serve() + # Remove the socket file so we don't get any more connections to avoid races os.unlink(self.sockname) self.sock.close() -- cgit v1.2.3-54-g00ecf