summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bblayers
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2020-09-09 04:55:20 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-10 13:49:21 +0100
commitf738ed43e93eaf971615ef5105ece567f280c85e (patch)
treeb51ce9ee8ec5948af22e1a3dbc3127b711279bf3 /bitbake/lib/bblayers
parentf543535e3ca4d86bee10801450dc22f3b5382b4c (diff)
downloadpoky-f738ed43e93eaf971615ef5105ece567f280c85e.tar.gz
bitbake: utils.py: get_file_layer(): Improve performance
The following code costs a lot of time when there are lot of layers and recipes: for collection in collections: collection_res[collection] = d.getVar('BBFILE_PATTERN_%s' % collection) or '' My build has more than 100 layers and 3000 recipes, which calls d.getVar() 300K (3000 * 100) times and makes 'bitbake-layers show-recipes' very slow, add a keyword argument to get_file_layer() can fix the problem, it can save about 90% time in my build (6min -> 40s). (Bitbake rev: f08a6601c9bb09622855d62e1cedb92fafd2f71d) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bblayers')
-rw-r--r--bitbake/lib/bblayers/query.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/bitbake/lib/bblayers/query.py b/bitbake/lib/bblayers/query.py
index ee2db0efed..f5e3c84747 100644
--- a/bitbake/lib/bblayers/query.py
+++ b/bitbake/lib/bblayers/query.py
@@ -21,6 +21,10 @@ def plugin_init(plugins):
21 21
22 22
23class QueryPlugin(LayerPlugin): 23class QueryPlugin(LayerPlugin):
24 def __init__(self):
25 super(QueryPlugin, self).__init__()
26 self.collection_res = {}
27
24 def do_show_layers(self, args): 28 def do_show_layers(self, args):
25 """show current configured layers.""" 29 """show current configured layers."""
26 logger.plain("%s %s %s" % ("layer".ljust(20), "path".ljust(40), "priority")) 30 logger.plain("%s %s %s" % ("layer".ljust(20), "path".ljust(40), "priority"))
@@ -222,7 +226,6 @@ skipped recipes will also be listed, with a " (skipped)" suffix.
222 multilayer = True 226 multilayer = True
223 if prov[0] != pref[0]: 227 if prov[0] != pref[0]:
224 same_ver = False 228 same_ver = False
225
226 if (multilayer or not show_overlayed_only) and (same_ver or not show_same_ver_only): 229 if (multilayer or not show_overlayed_only) and (same_ver or not show_same_ver_only):
227 if not items_listed: 230 if not items_listed:
228 logger.plain('=== %s ===' % title) 231 logger.plain('=== %s ===' % title)
@@ -243,8 +246,13 @@ skipped recipes will also be listed, with a " (skipped)" suffix.
243 else: 246 else:
244 return '?' 247 return '?'
245 248
249 def get_collection_res(self):
250 if not self.collection_res:
251 self.collection_res = bb.utils.get_collection_res(self.tinfoil.config_data)
252 return self.collection_res
253
246 def get_file_layerdir(self, filename): 254 def get_file_layerdir(self, filename):
247 layer = bb.utils.get_file_layer(filename, self.tinfoil.config_data) 255 layer = bb.utils.get_file_layer(filename, self.tinfoil.config_data, self.get_collection_res())
248 return self.bbfile_collections.get(layer, None) 256 return self.bbfile_collections.get(layer, None)
249 257
250 def remove_layer_prefix(self, f): 258 def remove_layer_prefix(self, f):