diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2024-07-27 20:39:31 -0700 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2024-08-23 14:51:51 -0700 |
commit | 54d061affed29c7fbefcae92b5b3fbfcc971ccd7 (patch) | |
tree | 217593040ae5fd763e8a37fd6672eaa7f449d47e | |
parent | 7db7a86fbc28eb8b7616010ee4542664ee65ef4f (diff) | |
download | poky-54d061affed29c7fbefcae92b5b3fbfcc971ccd7.tar.gz |
bitbake: data_smart: Improve performance for VariableHistory
Fixed:
- BBMULTICONFIG = "qemux86-64 qemuarm64" and more than 70 layers in BBLAYERS
$ bitbake -p -P
Check profile.log.processed, the record() cost more than 20 seconds, it is less
than 1 second when multiconfig is not enabled, and there would be the following
error when more muticonfigs are enabled:
Timeout while waiting for a reply from the bitbake server
Don't change the type of loginfo['detail'] or re-assign it can make record()
back to less than 1 second, this won't affect COW since loginfo is a mutable
type.
The time mainly affected by two factors:
1) The number of enabled layers, nearly 1 second added per layer when the
number is larger than 50.
2) The global var such as USER_CLASSES, about 1 ~ 2 seconds added per layer
when the layers number is larger than 50.
(Bitbake rev: ec2a99a077da9aa0e99e8b05e0c65dcbd45864b1)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0596aa0d5b0e4ed3db11b5bd560f1d3439963a41)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index dd20ca557e..111377a753 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -261,12 +261,9 @@ class VariableHistory(object): | |||
261 | return | 261 | return |
262 | if 'op' not in loginfo or not loginfo['op']: | 262 | if 'op' not in loginfo or not loginfo['op']: |
263 | loginfo['op'] = 'set' | 263 | loginfo['op'] = 'set' |
264 | if 'detail' in loginfo: | ||
265 | loginfo['detail'] = str(loginfo['detail']) | ||
266 | if 'variable' not in loginfo or 'file' not in loginfo: | 264 | if 'variable' not in loginfo or 'file' not in loginfo: |
267 | raise ValueError("record() missing variable or file.") | 265 | raise ValueError("record() missing variable or file.") |
268 | var = loginfo['variable'] | 266 | var = loginfo['variable'] |
269 | |||
270 | if var not in self.variables: | 267 | if var not in self.variables: |
271 | self.variables[var] = [] | 268 | self.variables[var] = [] |
272 | if not isinstance(self.variables[var], list): | 269 | if not isinstance(self.variables[var], list): |
@@ -325,7 +322,8 @@ class VariableHistory(object): | |||
325 | flag = '[%s] ' % (event['flag']) | 322 | flag = '[%s] ' % (event['flag']) |
326 | else: | 323 | else: |
327 | flag = '' | 324 | flag = '' |
328 | o.write("# %s %s:%s%s\n# %s\"%s\"\n" % (event['op'], event['file'], event['line'], display_func, flag, re.sub('\n', '\n# ', event['detail']))) | 325 | o.write("# %s %s:%s%s\n# %s\"%s\"\n" % \ |
326 | (event['op'], event['file'], event['line'], display_func, flag, re.sub('\n', '\n# ', str(event['detail'])))) | ||
329 | if len(history) > 1: | 327 | if len(history) > 1: |
330 | o.write("# pre-expansion value:\n") | 328 | o.write("# pre-expansion value:\n") |
331 | o.write('# "%s"\n' % (commentVal)) | 329 | o.write('# "%s"\n' % (commentVal)) |
@@ -379,7 +377,7 @@ class VariableHistory(object): | |||
379 | if isset and event['op'] == 'set?': | 377 | if isset and event['op'] == 'set?': |
380 | continue | 378 | continue |
381 | isset = True | 379 | isset = True |
382 | items = d.expand(event['detail']).split() | 380 | items = d.expand(str(event['detail'])).split() |
383 | for item in items: | 381 | for item in items: |
384 | # This is a little crude but is belt-and-braces to avoid us | 382 | # This is a little crude but is belt-and-braces to avoid us |
385 | # having to handle every possible operation type specifically | 383 | # having to handle every possible operation type specifically |