From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH] cooker: Log config and parse cache status changes
Date: Mon, 1 May 2023 23:08:28 +0100 [thread overview]
Message-ID: <20230501220828.2781291-1-richard.purdie@linuxfoundation.org> (raw)
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.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
lib/bb/cooker.py | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index f33bca4f86..554c7f10a5 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -151,6 +151,8 @@ class BBCooker:
def __init__(self, featureSet=None, server=None):
self.recipecaches = None
+ self.baseconfig_valid = False
+ self.parsecache_valid = False
self.eventlog = None
self.skiplist = {}
self.featureset = CookerFeatures()
@@ -264,11 +266,25 @@ class BBCooker:
n.read_events()
n.process_events()
+ def _baseconfig_set(self, value):
+ if value and not self.baseconfig_valid:
+ bb.server.process.serverlog("Base config valid")
+ elif not value and self.baseconfig_valid:
+ bb.server.process.serverlog("Base config invalidated")
+ self.baseconfig_valid = value
+
+ def _parsecache_set(self, value):
+ if value and not self.parsecache_valid:
+ bb.server.process.serverlog("Parse cache valid")
+ elif not value and self.parsecache_valid:
+ bb.server.process.serverlog("Parse cache invalidated")
+ self.parsecache_valid = value
+
def config_notifications(self, event):
if event.maskname == "IN_Q_OVERFLOW":
bb.warn("inotify event queue overflowed, invalidating caches.")
- self.parsecache_valid = False
- self.baseconfig_valid = False
+ self._parsecache_set(False)
+ self._baseconfig_set(False)
bb.parse.clear_cache()
return
if not event.pathname in self.configwatcher.bbwatchedfiles:
@@ -281,12 +297,12 @@ class BBCooker:
bb.parse.clear_cache()
if not event.pathname in self.inotify_modified_files:
self.inotify_modified_files.append(event.pathname)
- self.baseconfig_valid = False
+ self._baseconfig_set(False)
def notifications(self, event):
if event.maskname == "IN_Q_OVERFLOW":
bb.warn("inotify event queue overflowed, invalidating caches.")
- self.parsecache_valid = False
+ self._parsecache_set(False)
bb.parse.clear_cache()
return
if event.pathname.endswith("bitbake-cookerdaemon.log") \
@@ -300,7 +316,7 @@ class BBCooker:
bb.parse.clear_cache()
if not event.pathname in self.inotify_modified_files:
self.inotify_modified_files.append(event.pathname)
- self.parsecache_valid = False
+ self._parsecache_set(False)
def add_filewatch(self, deps, watcher=None, dirs=False):
if not watcher:
@@ -422,8 +438,8 @@ class BBCooker:
for mc in self.databuilder.mcdata.values():
self.add_filewatch(mc.getVar("__base_depends", False), self.configwatcher)
- self.baseconfig_valid = True
- self.parsecache_valid = False
+ self._baseconfig_set(True)
+ self._parsecache_set(False)
def handlePRServ(self):
# Setup a PR Server based on the new configuration
@@ -489,7 +505,7 @@ class BBCooker:
self.handleCollections(self.data.getVar("BBFILE_COLLECTIONS"))
- self.parsecache_valid = False
+ self._parsecache_set(False)
def updateConfigOpts(self, options, environment, cmdline):
self.ui_cmdline = cmdline
@@ -1509,7 +1525,7 @@ class BBCooker:
bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc])
bb.event.disable_heartbeat()
# We trashed self.recipecaches above
- self.parsecache_valid = False
+ self._parsecache_set(False)
self.configuration.limited_deps = False
bb.parse.siggen.reset(self.data)
if quietlog:
@@ -1678,7 +1694,7 @@ class BBCooker:
self.add_filewatch([[dirent]], dirs=True)
self.parser = CookerParser(self, mcfilelist, total_masked)
- self.parsecache_valid = True
+ self._parsecache_set(True)
self.state = state.parsing
@@ -1796,8 +1812,7 @@ class BBCooker:
self.data = self.databuilder.data
# In theory tinfoil could have modified the base data before parsing,
# ideally need to track if anything did modify the datastore
- self.parsecache_valid = False
-
+ self._parsecache_set(False)
class CookerExit(bb.event.Event):
"""
--
2.39.2
reply other threads:[~2023-05-01 22:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230501220828.2781291-1-richard.purdie@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).