All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cooker: Improve pyinotify performance
@ 2015-01-15  9:39 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2015-01-15  9:39 UTC (permalink / raw)
  To: bitbake-devel

Benchmarks show that the introduction of pyinotify regressed
performance. This patch ensures we only call the add_watch() function
for new entries, not ones we've already processed which does improve
performance as measured by "time bitbake -p".

This doesn't completely remove the overhead but it does substantially
reduce it.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 594dbd5..61cc1b7 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -122,11 +122,13 @@ class BBCooker:
         self.configuration = configuration
 
         self.configwatcher = pyinotify.WatchManager()
+        self.configwatcher.bbseen = []
         self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications)
         self.watchmask = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_CREATE | pyinotify.IN_DELETE | \
                          pyinotify.IN_DELETE_SELF | pyinotify.IN_MODIFY | pyinotify.IN_MOVE_SELF | \
                          pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO 
         self.watcher = pyinotify.WatchManager()
+        self.watcher.bbseen = []
         self.notifier = pyinotify.Notifier(self.watcher, self.notifications)
 
 
@@ -181,6 +183,9 @@ class BBCooker:
             watcher = self.watcher
         for i in deps:
             f = i[0]
+            if f in watcher.bbseen:
+                continue
+            watcher.bbseen.append(f)
             while True:
                 #bb.warn(f)
                 # We try and add watches for files that don't exist but if they did, would influence
@@ -192,6 +197,7 @@ class BBCooker:
                 except pyinotify.WatchManagerError as e:
                     if 'ENOENT' in str(e):
                         f = os.path.dirname(f)
+                        watcher.bbseen.append(f)
                         continue
                     raise
 




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-15  9:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-15  9:39 [PATCH] cooker: Improve pyinotify performance Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.