summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-15 09:39:34 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-16 08:25:30 +0000
commit967f13fda096e0c1cc429ce55a8e305894a8b576 (patch)
tree27b615bb886c8ec4d457f0171b0d55a071d36f9c /bitbake
parent10837473b27aa1708866eb2b1b5701daa984e94e (diff)
downloadpoky-967f13fda096e0c1cc429ce55a8e305894a8b576.tar.gz
bitbake: cooker: Improve pyinotify performance
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. (Bitbake rev: 493361f35f6cc332d4ea359a2695622c2c91a9c2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index d065b4dc4e..95f65ac685 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -122,11 +122,13 @@ class BBCooker:
122 self.configuration = configuration 122 self.configuration = configuration
123 123
124 self.configwatcher = pyinotify.WatchManager() 124 self.configwatcher = pyinotify.WatchManager()
125 self.configwatcher.bbseen = []
125 self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications) 126 self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications)
126 self.watchmask = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_CREATE | pyinotify.IN_DELETE | \ 127 self.watchmask = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_CREATE | pyinotify.IN_DELETE | \
127 pyinotify.IN_DELETE_SELF | pyinotify.IN_MODIFY | pyinotify.IN_MOVE_SELF | \ 128 pyinotify.IN_DELETE_SELF | pyinotify.IN_MODIFY | pyinotify.IN_MOVE_SELF | \
128 pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO 129 pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO
129 self.watcher = pyinotify.WatchManager() 130 self.watcher = pyinotify.WatchManager()
131 self.watcher.bbseen = []
130 self.notifier = pyinotify.Notifier(self.watcher, self.notifications) 132 self.notifier = pyinotify.Notifier(self.watcher, self.notifications)
131 133
132 134
@@ -181,6 +183,9 @@ class BBCooker:
181 watcher = self.watcher 183 watcher = self.watcher
182 for i in deps: 184 for i in deps:
183 f = i[0] 185 f = i[0]
186 if f in watcher.bbseen:
187 continue
188 watcher.bbseen.append(f)
184 while True: 189 while True:
185 # We try and add watches for files that don't exist but if they did, would influence 190 # We try and add watches for files that don't exist but if they did, would influence
186 # the parser. The parent directory of these files may not exist, in which case we need 191 # the parser. The parent directory of these files may not exist, in which case we need
@@ -191,6 +196,7 @@ class BBCooker:
191 except pyinotify.WatchManagerError as e: 196 except pyinotify.WatchManagerError as e:
192 if 'ENOENT' in str(e): 197 if 'ENOENT' in str(e):
193 f = os.path.dirname(f) 198 f = os.path.dirname(f)
199 watcher.bbseen.append(f)
194 continue 200 continue
195 raise 201 raise
196 202