diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-16 15:56:38 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-17 10:45:57 +0100 |
commit | e16dd314450cb2b85e4984c17fa60403b662ef8c (patch) | |
tree | 0e3276eae79d9f130183188df5fa64698e66b466 /bitbake/lib/bb/cooker.py | |
parent | 6933d4b57ef9b2b6bbc8c97069a4f54e46eb3e4d (diff) | |
download | poky-e16dd314450cb2b85e4984c17fa60403b662ef8c.tar.gz |
bitbake: cooker/process/utils: Create profiling common function to remove code duplication
We have code duplication in the way we handle profiling of code sections.
Create a common function in utils which covers this.
The main loop and idle loop profile files were also reversed. Fix this and the naming,
removing a couple of unused variables containing the profile log names in the process too.
(Bitbake rev: b4f6bae97ac9607420fc49fd4c9e957d89c9a5f3)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index dc131939ed..c60fcd2719 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -2027,21 +2027,7 @@ class Parser(multiprocessing.Process): | |||
2027 | self.exit = True | 2027 | self.exit = True |
2028 | 2028 | ||
2029 | def run(self): | 2029 | def run(self): |
2030 | 2030 | bb.utils.profile_function(self.profile, self.realrun, "profile-parse-%s.log" % multiprocessing.current_process().name, process=False) | |
2031 | if not self.profile: | ||
2032 | self.realrun() | ||
2033 | return | ||
2034 | |||
2035 | try: | ||
2036 | import cProfile as profile | ||
2037 | except: | ||
2038 | import profile | ||
2039 | prof = profile.Profile() | ||
2040 | try: | ||
2041 | profile.Profile.runcall(prof, self.realrun) | ||
2042 | finally: | ||
2043 | logfile = "profile-parse-%s.log" % multiprocessing.current_process().name | ||
2044 | prof.dump_stats(logfile) | ||
2045 | 2031 | ||
2046 | def realrun(self): | 2032 | def realrun(self): |
2047 | # Signal handling here is hard. We must not terminate any process or thread holding the write | 2033 | # Signal handling here is hard. We must not terminate any process or thread holding the write |