diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-10 15:57:05 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-11 16:21:48 +0100 |
commit | 763bff1f2210734c189f44478466125c3ce0a8b2 (patch) | |
tree | 3330aa1c09107f252a73e02c00eee9d630384f80 /bitbake/lib/bb/cooker.py | |
parent | 0d1f75b9d67aa796a14be115e9f04d5d6247ce40 (diff) | |
download | poky-763bff1f2210734c189f44478466125c3ce0a8b2.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)
(Bitbake rev: f668b347a8f9563f41d454288b9d4632190f308f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index e965bcc440..3909dc09f7 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 | ||
@@ -180,7 +182,7 @@ class BBCooker: | |||
180 | if not watcher: | 182 | if not watcher: |
181 | watcher = self.watcher | 183 | watcher = self.watcher |
182 | for i in deps: | 184 | for i in deps: |
183 | f = os.path.dirname(i[0]) | 185 | f = i[0] |
184 | if f in watcher.bbseen: | 186 | if f in watcher.bbseen: |
185 | continue | 187 | continue |
186 | watcher.bbseen.append(f) | 188 | watcher.bbseen.append(f) |
@@ -194,6 +196,7 @@ class BBCooker: | |||
194 | except pyinotify.WatchManagerError as e: | 196 | except pyinotify.WatchManagerError as e: |
195 | if 'ENOENT' in str(e): | 197 | if 'ENOENT' in str(e): |
196 | f = os.path.dirname(f) | 198 | f = os.path.dirname(f) |
199 | watcher.bbseen.append(f) | ||
197 | continue | 200 | continue |
198 | raise | 201 | raise |
199 | 202 | ||