diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-09 23:55:40 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-10 14:13:49 +0000 |
commit | d8d5cd43a60560f67e86f4f625113b0f73b944c0 (patch) | |
tree | 80202b509887d238d6682d3a2e8485a1c4ec710d /lib | |
parent | ae1e4c90bbc2002cb2728c64649c095c00220ceb (diff) | |
download | bitbake-d8d5cd43a60560f67e86f4f625113b0f73b944c0.tar.gz |
process: Add profile logging for main loop
When the idle/main loop was added, we didn't include profiling information
for it. There is a performance issue in there, add logging for it.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bb/server/process.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py index 6d77ce478..1ca8e02ba 100644 --- a/lib/bb/server/process.py +++ b/lib/bb/server/process.py @@ -402,6 +402,22 @@ class ProcessServer(): serverlog("".join(msg)) def idle_thread(self): + if self.cooker.configuration.profile: + try: + import cProfile as profile + except: + import profile + prof = profile.Profile() + + ret = profile.Profile.runcall(prof, self.idle_thread_internal) + + prof.dump_stats("profile-mainloop.log") + bb.utils.process_profilelog("profile-mainloop.log") + serverlog("Raw profiling information saved to profilemainloop.log and processed statistics to profilemainloop.log.processed") + else: + self.idle_thread_internal() + + def idle_thread_internal(self): def remove_idle_func(function): with bb.utils.lock_timeout(self._idlefuncsLock): del self._idlefuns[function] |