diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-24 11:41:44 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-24 23:28:35 +0100 |
commit | f5f6748b757b7480efcae4fe345615990f907f81 (patch) | |
tree | 1eb71c9fddc2021bbfc550b18e1962b277987f2f /bitbake/lib/bb/data_smart.py | |
parent | 9901415ecd11df0da73fccd867c4f1ba39abc9ab (diff) | |
download | poky-f5f6748b757b7480efcae4fe345615990f907f81.tar.gz |
bitbake: data_smart: Improve override history logging
Calling record() for each override alteration is slow. Since we now expand
overrides dynamically we don't have to record the log data at each alteration,
we can instead print it directly from the existing data stores at variable
history print time using the exact same data stores.
This massively improves performance of the data store when parsing
with bitbake -e for example, it will improve memory overhead as well.
The only downside is that VariableHistory has to poke into the datastore
for some of its data but that seems an acceptable tradeoff rather than
double caching.
(Bitbake rev: 100b447a161ef20fa559e39516cd32fa78e38262)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index f0187b7a17..26f69d105a 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -252,8 +252,20 @@ class VariableHistory(object): | |||
252 | else: | 252 | else: |
253 | return [] | 253 | return [] |
254 | 254 | ||
255 | def emit(self, var, oval, val, o): | 255 | def emit(self, var, oval, val, o, d): |
256 | history = self.variable(var) | 256 | history = self.variable(var) |
257 | |||
258 | # Append override history | ||
259 | if var in d.overridedata: | ||
260 | for (r, override) in d.overridedata[var]: | ||
261 | for event in self.variable(r): | ||
262 | loginfo = event.copy() | ||
263 | if 'flag' in loginfo and not loginfo['flag'].startswith("_"): | ||
264 | continue | ||
265 | loginfo['variable'] = var | ||
266 | loginfo['op'] = 'override[%s]:%s' % (override, loginfo['op']) | ||
267 | history.append(loginfo) | ||
268 | |||
257 | commentVal = re.sub('\n', '\n#', str(oval)) | 269 | commentVal = re.sub('\n', '\n#', str(oval)) |
258 | if history: | 270 | if history: |
259 | if len(history) == 1: | 271 | if len(history) == 1: |
@@ -496,15 +508,6 @@ class DataSmart(MutableMapping): | |||
496 | # Force CoW by recreating the list first | 508 | # Force CoW by recreating the list first |
497 | self.overridedata[shortvar] = list(self.overridedata[shortvar]) | 509 | self.overridedata[shortvar] = list(self.overridedata[shortvar]) |
498 | self.overridedata[shortvar].append([var, override]) | 510 | self.overridedata[shortvar].append([var, override]) |
499 | for event in self.varhistory.variable(var): | ||
500 | if 'flag' in loginfo and not loginfo['flag'].startswith("_"): | ||
501 | continue | ||
502 | loginfo = event.copy() | ||
503 | loginfo['variable'] = shortvar | ||
504 | loginfo['op'] = 'override[%s]:%s' % (override, loginfo['op']) | ||
505 | loginfo['nodups'] = True | ||
506 | self.varhistory.record(**loginfo) | ||
507 | |||
508 | override = None | 511 | override = None |
509 | if "_" in shortvar: | 512 | if "_" in shortvar: |
510 | override = var[shortvar.rfind('_')+1:] | 513 | override = var[shortvar.rfind('_')+1:] |