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:51 +0000 |
| commit | 0f50f21151f302d4b4db115866a907628bcd4e3c (patch) | |
| tree | 3e59adc30ad667703a738f2850254f5ff043632c /bitbake/lib/bb/server/process.py | |
| parent | 38657590e74bf12cd63242dd389a549aebd0fd04 (diff) | |
| download | poky-0f50f21151f302d4b4db115866a907628bcd4e3c.tar.gz | |
bitbake: 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.
(Bitbake rev: d8d5cd43a60560f67e86f4f625113b0f73b944c0)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
| -rw-r--r-- | bitbake/lib/bb/server/process.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 6d77ce4786..1ca8e02ba0 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
| @@ -402,6 +402,22 @@ class ProcessServer(): | |||
| 402 | serverlog("".join(msg)) | 402 | serverlog("".join(msg)) |
| 403 | 403 | ||
| 404 | def idle_thread(self): | 404 | def idle_thread(self): |
| 405 | if self.cooker.configuration.profile: | ||
| 406 | try: | ||
| 407 | import cProfile as profile | ||
| 408 | except: | ||
| 409 | import profile | ||
| 410 | prof = profile.Profile() | ||
| 411 | |||
| 412 | ret = profile.Profile.runcall(prof, self.idle_thread_internal) | ||
| 413 | |||
| 414 | prof.dump_stats("profile-mainloop.log") | ||
| 415 | bb.utils.process_profilelog("profile-mainloop.log") | ||
| 416 | serverlog("Raw profiling information saved to profilemainloop.log and processed statistics to profilemainloop.log.processed") | ||
| 417 | else: | ||
| 418 | self.idle_thread_internal() | ||
| 419 | |||
| 420 | def idle_thread_internal(self): | ||
| 405 | def remove_idle_func(function): | 421 | def remove_idle_func(function): |
| 406 | with bb.utils.lock_timeout(self._idlefuncsLock): | 422 | with bb.utils.lock_timeout(self._idlefuncsLock): |
| 407 | del self._idlefuns[function] | 423 | del self._idlefuns[function] |
