diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-04-28 14:12:47 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-05-02 10:24:50 +0100 |
commit | af405613151c730f5d5d3f5c9df25721671e19ba (patch) | |
tree | 0a3bba74e4a2b6000fd81131290f704ff953e112 /bitbake/lib/bb/cooker.py | |
parent | cce6db2a59d309f77c1f9ca173fc674c506062d0 (diff) | |
download | poky-af405613151c730f5d5d3f5c9df25721671e19ba.tar.gz |
bitbake: cooker: Log config and parse cache status changes
It can be hard to tell why bitbake does some things slowly. Log the changes
to the base configuration and parse cache status so that it becomes clear
from the logs when the cache invalidation causes a slowdown.
(Bitbake rev: 6e99d89f3c00a5f53c24d687eaef24f52fe0ef99)
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 | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index f33bca4f86..554c7f10a5 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -151,6 +151,8 @@ class BBCooker: | |||
151 | 151 | ||
152 | def __init__(self, featureSet=None, server=None): | 152 | def __init__(self, featureSet=None, server=None): |
153 | self.recipecaches = None | 153 | self.recipecaches = None |
154 | self.baseconfig_valid = False | ||
155 | self.parsecache_valid = False | ||
154 | self.eventlog = None | 156 | self.eventlog = None |
155 | self.skiplist = {} | 157 | self.skiplist = {} |
156 | self.featureset = CookerFeatures() | 158 | self.featureset = CookerFeatures() |
@@ -264,11 +266,25 @@ class BBCooker: | |||
264 | n.read_events() | 266 | n.read_events() |
265 | n.process_events() | 267 | n.process_events() |
266 | 268 | ||
269 | def _baseconfig_set(self, value): | ||
270 | if value and not self.baseconfig_valid: | ||
271 | bb.server.process.serverlog("Base config valid") | ||
272 | elif not value and self.baseconfig_valid: | ||
273 | bb.server.process.serverlog("Base config invalidated") | ||
274 | self.baseconfig_valid = value | ||
275 | |||
276 | def _parsecache_set(self, value): | ||
277 | if value and not self.parsecache_valid: | ||
278 | bb.server.process.serverlog("Parse cache valid") | ||
279 | elif not value and self.parsecache_valid: | ||
280 | bb.server.process.serverlog("Parse cache invalidated") | ||
281 | self.parsecache_valid = value | ||
282 | |||
267 | def config_notifications(self, event): | 283 | def config_notifications(self, event): |
268 | if event.maskname == "IN_Q_OVERFLOW": | 284 | if event.maskname == "IN_Q_OVERFLOW": |
269 | bb.warn("inotify event queue overflowed, invalidating caches.") | 285 | bb.warn("inotify event queue overflowed, invalidating caches.") |
270 | self.parsecache_valid = False | 286 | self._parsecache_set(False) |
271 | self.baseconfig_valid = False | 287 | self._baseconfig_set(False) |
272 | bb.parse.clear_cache() | 288 | bb.parse.clear_cache() |
273 | return | 289 | return |
274 | if not event.pathname in self.configwatcher.bbwatchedfiles: | 290 | if not event.pathname in self.configwatcher.bbwatchedfiles: |
@@ -281,12 +297,12 @@ class BBCooker: | |||
281 | bb.parse.clear_cache() | 297 | bb.parse.clear_cache() |
282 | if not event.pathname in self.inotify_modified_files: | 298 | if not event.pathname in self.inotify_modified_files: |
283 | self.inotify_modified_files.append(event.pathname) | 299 | self.inotify_modified_files.append(event.pathname) |
284 | self.baseconfig_valid = False | 300 | self._baseconfig_set(False) |
285 | 301 | ||
286 | def notifications(self, event): | 302 | def notifications(self, event): |
287 | if event.maskname == "IN_Q_OVERFLOW": | 303 | if event.maskname == "IN_Q_OVERFLOW": |
288 | bb.warn("inotify event queue overflowed, invalidating caches.") | 304 | bb.warn("inotify event queue overflowed, invalidating caches.") |
289 | self.parsecache_valid = False | 305 | self._parsecache_set(False) |
290 | bb.parse.clear_cache() | 306 | bb.parse.clear_cache() |
291 | return | 307 | return |
292 | if event.pathname.endswith("bitbake-cookerdaemon.log") \ | 308 | if event.pathname.endswith("bitbake-cookerdaemon.log") \ |
@@ -300,7 +316,7 @@ class BBCooker: | |||
300 | bb.parse.clear_cache() | 316 | bb.parse.clear_cache() |
301 | if not event.pathname in self.inotify_modified_files: | 317 | if not event.pathname in self.inotify_modified_files: |
302 | self.inotify_modified_files.append(event.pathname) | 318 | self.inotify_modified_files.append(event.pathname) |
303 | self.parsecache_valid = False | 319 | self._parsecache_set(False) |
304 | 320 | ||
305 | def add_filewatch(self, deps, watcher=None, dirs=False): | 321 | def add_filewatch(self, deps, watcher=None, dirs=False): |
306 | if not watcher: | 322 | if not watcher: |
@@ -422,8 +438,8 @@ class BBCooker: | |||
422 | for mc in self.databuilder.mcdata.values(): | 438 | for mc in self.databuilder.mcdata.values(): |
423 | self.add_filewatch(mc.getVar("__base_depends", False), self.configwatcher) | 439 | self.add_filewatch(mc.getVar("__base_depends", False), self.configwatcher) |
424 | 440 | ||
425 | self.baseconfig_valid = True | 441 | self._baseconfig_set(True) |
426 | self.parsecache_valid = False | 442 | self._parsecache_set(False) |
427 | 443 | ||
428 | def handlePRServ(self): | 444 | def handlePRServ(self): |
429 | # Setup a PR Server based on the new configuration | 445 | # Setup a PR Server based on the new configuration |
@@ -489,7 +505,7 @@ class BBCooker: | |||
489 | 505 | ||
490 | self.handleCollections(self.data.getVar("BBFILE_COLLECTIONS")) | 506 | self.handleCollections(self.data.getVar("BBFILE_COLLECTIONS")) |
491 | 507 | ||
492 | self.parsecache_valid = False | 508 | self._parsecache_set(False) |
493 | 509 | ||
494 | def updateConfigOpts(self, options, environment, cmdline): | 510 | def updateConfigOpts(self, options, environment, cmdline): |
495 | self.ui_cmdline = cmdline | 511 | self.ui_cmdline = cmdline |
@@ -1509,7 +1525,7 @@ class BBCooker: | |||
1509 | bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc]) | 1525 | bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc]) |
1510 | bb.event.disable_heartbeat() | 1526 | bb.event.disable_heartbeat() |
1511 | # We trashed self.recipecaches above | 1527 | # We trashed self.recipecaches above |
1512 | self.parsecache_valid = False | 1528 | self._parsecache_set(False) |
1513 | self.configuration.limited_deps = False | 1529 | self.configuration.limited_deps = False |
1514 | bb.parse.siggen.reset(self.data) | 1530 | bb.parse.siggen.reset(self.data) |
1515 | if quietlog: | 1531 | if quietlog: |
@@ -1678,7 +1694,7 @@ class BBCooker: | |||
1678 | self.add_filewatch([[dirent]], dirs=True) | 1694 | self.add_filewatch([[dirent]], dirs=True) |
1679 | 1695 | ||
1680 | self.parser = CookerParser(self, mcfilelist, total_masked) | 1696 | self.parser = CookerParser(self, mcfilelist, total_masked) |
1681 | self.parsecache_valid = True | 1697 | self._parsecache_set(True) |
1682 | 1698 | ||
1683 | self.state = state.parsing | 1699 | self.state = state.parsing |
1684 | 1700 | ||
@@ -1796,8 +1812,7 @@ class BBCooker: | |||
1796 | self.data = self.databuilder.data | 1812 | self.data = self.databuilder.data |
1797 | # In theory tinfoil could have modified the base data before parsing, | 1813 | # In theory tinfoil could have modified the base data before parsing, |
1798 | # ideally need to track if anything did modify the datastore | 1814 | # ideally need to track if anything did modify the datastore |
1799 | self.parsecache_valid = False | 1815 | self._parsecache_set(False) |
1800 | |||
1801 | 1816 | ||
1802 | class CookerExit(bb.event.Event): | 1817 | class CookerExit(bb.event.Event): |
1803 | """ | 1818 | """ |