diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-01-15 09:39:34 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-01-16 08:25:30 +0000 |
commit | 967f13fda096e0c1cc429ce55a8e305894a8b576 (patch) | |
tree | 27b615bb886c8ec4d457f0171b0d55a071d36f9c | |
parent | 10837473b27aa1708866eb2b1b5701daa984e94e (diff) | |
download | ast2050-yocto-poky-967f13fda096e0c1cc429ce55a8e305894a8b576.zip ast2050-yocto-poky-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>
-rw-r--r-- | bitbake/lib/bb/cooker.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index d065b4d..95f65ac 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: # We try and add watches for files that don't exist but if they did, would influence # the parser. The parent directory of these files may not exist, in which case we need @@ -191,6 +196,7 @@ class BBCooker: except pyinotify.WatchManagerError as e: if 'ENOENT' in str(e): f = os.path.dirname(f) + watcher.bbseen.append(f) continue raise |