summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2020-01-07 23:08:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-28 11:51:03 +0000
commit9b931545281edc33966266e1dd7a025be3838bb7 (patch)
treee7744f8d55c43facac7362f09813bfe95f375a15 /bitbake
parent5fd44938fd80021d4be54e653cf0532baec5fc8e (diff)
downloadpoky-9b931545281edc33966266e1dd7a025be3838bb7.tar.gz
bitbake: cooker: Keep track of watched files using a set instead of a list
When there are many watched files, keeping track of them using lists is suboptimal. Using sets improves the performance considerably. (Bitbake rev: 16799ada1cda8e021cb04c43e469225790525723) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 1e96df260e47d160dbd36bfc92c31ef06266f662) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index e6442bff93..b74affa7ec 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -169,8 +169,8 @@ class BBCooker:
169 bb.debug(1, "BBCooker pyinotify1 %s" % time.time()) 169 bb.debug(1, "BBCooker pyinotify1 %s" % time.time())
170 sys.stdout.flush() 170 sys.stdout.flush()
171 171
172 self.configwatcher.bbseen = [] 172 self.configwatcher.bbseen = set()
173 self.configwatcher.bbwatchedfiles = [] 173 self.configwatcher.bbwatchedfiles = set()
174 self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications) 174 self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications)
175 bb.debug(1, "BBCooker pyinotify2 %s" % time.time()) 175 bb.debug(1, "BBCooker pyinotify2 %s" % time.time())
176 sys.stdout.flush() 176 sys.stdout.flush()
@@ -180,8 +180,8 @@ class BBCooker:
180 self.watcher = pyinotify.WatchManager() 180 self.watcher = pyinotify.WatchManager()
181 bb.debug(1, "BBCooker pyinotify3 %s" % time.time()) 181 bb.debug(1, "BBCooker pyinotify3 %s" % time.time())
182 sys.stdout.flush() 182 sys.stdout.flush()
183 self.watcher.bbseen = [] 183 self.watcher.bbseen = set()
184 self.watcher.bbwatchedfiles = [] 184 self.watcher.bbwatchedfiles = set()
185 self.notifier = pyinotify.Notifier(self.watcher, self.notifications) 185 self.notifier = pyinotify.Notifier(self.watcher, self.notifications)
186 186
187 bb.debug(1, "BBCooker pyinotify complete %s" % time.time()) 187 bb.debug(1, "BBCooker pyinotify complete %s" % time.time())
@@ -278,14 +278,14 @@ class BBCooker:
278 if not watcher: 278 if not watcher:
279 watcher = self.watcher 279 watcher = self.watcher
280 for i in deps: 280 for i in deps:
281 watcher.bbwatchedfiles.append(i[0]) 281 watcher.bbwatchedfiles.add(i[0])
282 if dirs: 282 if dirs:
283 f = i[0] 283 f = i[0]
284 else: 284 else:
285 f = os.path.dirname(i[0]) 285 f = os.path.dirname(i[0])
286 if f in watcher.bbseen: 286 if f in watcher.bbseen:
287 continue 287 continue
288 watcher.bbseen.append(f) 288 watcher.bbseen.add(f)
289 watchtarget = None 289 watchtarget = None
290 while True: 290 while True:
291 # We try and add watches for files that don't exist but if they did, would influence 291 # We try and add watches for files that don't exist but if they did, would influence
@@ -294,7 +294,7 @@ class BBCooker:
294 try: 294 try:
295 watcher.add_watch(f, self.watchmask, quiet=False) 295 watcher.add_watch(f, self.watchmask, quiet=False)
296 if watchtarget: 296 if watchtarget:
297 watcher.bbwatchedfiles.append(watchtarget) 297 watcher.bbwatchedfiles.add(watchtarget)
298 break 298 break
299 except pyinotify.WatchManagerError as e: 299 except pyinotify.WatchManagerError as e:
300 if 'ENOENT' in str(e): 300 if 'ENOENT' in str(e):
@@ -302,7 +302,7 @@ class BBCooker:
302 f = os.path.dirname(f) 302 f = os.path.dirname(f)
303 if f in watcher.bbseen: 303 if f in watcher.bbseen:
304 break 304 break
305 watcher.bbseen.append(f) 305 watcher.bbseen.add(f)
306 continue 306 continue
307 if 'ENOSPC' in str(e): 307 if 'ENOSPC' in str(e):
308 providerlog.error("No space left on device or exceeds fs.inotify.max_user_watches?") 308 providerlog.error("No space left on device or exceeds fs.inotify.max_user_watches?")