mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 18:49:32 +02:00
bitbake: runqueue: Improve performance for executing tasks
Now that runqueue performance profiling works again we can see a lot of time is lost in build_taskdepdata. Whilst we can't compute that in advance, we can compute the individual entries. Therefore put a cache in place to compute those and save overhead in starting up tasks. (Bitbake rev: c4519b542702ba25023e53d77b275a6fa571ec50) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -1914,6 +1914,8 @@ class RunQueueExecute:
|
|||||||
event = bb.event.StaleSetSceneTasks(found[mc])
|
event = bb.event.StaleSetSceneTasks(found[mc])
|
||||||
bb.event.fire(event, self.cooker.databuilder.mcdata[mc])
|
bb.event.fire(event, self.cooker.databuilder.mcdata[mc])
|
||||||
|
|
||||||
|
self.build_taskdepdata_cache()
|
||||||
|
|
||||||
def runqueue_process_waitpid(self, task, status, fakerootlog=None):
|
def runqueue_process_waitpid(self, task, status, fakerootlog=None):
|
||||||
|
|
||||||
# self.build_stamps[pid] may not exist when use shared work directory.
|
# self.build_stamps[pid] may not exist when use shared work directory.
|
||||||
@@ -2413,6 +2415,22 @@ class RunQueueExecute:
|
|||||||
ret.add(dep)
|
ret.add(dep)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
# Build the individual cache entries in advance once to save time
|
||||||
|
def build_taskdepdata_cache(self):
|
||||||
|
taskdepdata_cache = {}
|
||||||
|
for task in self.rqdata.runtaskentries:
|
||||||
|
(mc, fn, taskname, taskfn) = split_tid_mcfn(task)
|
||||||
|
pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn]
|
||||||
|
deps = self.rqdata.runtaskentries[task].depends
|
||||||
|
provides = self.rqdata.dataCaches[mc].fn_provides[taskfn]
|
||||||
|
taskhash = self.rqdata.runtaskentries[task].hash
|
||||||
|
unihash = self.rqdata.runtaskentries[task].unihash
|
||||||
|
deps = self.filtermcdeps(task, mc, deps)
|
||||||
|
hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn]
|
||||||
|
taskdepdata_cache[task] = [pn, taskname, fn, deps, provides, taskhash, unihash, hashfn]
|
||||||
|
|
||||||
|
self.taskdepdata_cache = taskdepdata_cache
|
||||||
|
|
||||||
# We filter out multiconfig dependencies from taskdepdata we pass to the tasks
|
# We filter out multiconfig dependencies from taskdepdata we pass to the tasks
|
||||||
# as most code can't handle them
|
# as most code can't handle them
|
||||||
def build_taskdepdata(self, task):
|
def build_taskdepdata(self, task):
|
||||||
@@ -2424,16 +2442,9 @@ class RunQueueExecute:
|
|||||||
while next:
|
while next:
|
||||||
additional = []
|
additional = []
|
||||||
for revdep in next:
|
for revdep in next:
|
||||||
(mc, fn, taskname, taskfn) = split_tid_mcfn(revdep)
|
self.taskdepdata_cache[revdep][6] = self.rqdata.runtaskentries[revdep].unihash
|
||||||
pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn]
|
taskdepdata[revdep] = self.taskdepdata_cache[revdep]
|
||||||
deps = self.rqdata.runtaskentries[revdep].depends
|
for revdep2 in self.taskdepdata_cache[revdep][3]:
|
||||||
provides = self.rqdata.dataCaches[mc].fn_provides[taskfn]
|
|
||||||
taskhash = self.rqdata.runtaskentries[revdep].hash
|
|
||||||
unihash = self.rqdata.runtaskentries[revdep].unihash
|
|
||||||
deps = self.filtermcdeps(task, mc, deps)
|
|
||||||
hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn]
|
|
||||||
taskdepdata[revdep] = [pn, taskname, fn, deps, provides, taskhash, unihash, hashfn]
|
|
||||||
for revdep2 in deps:
|
|
||||||
if revdep2 not in taskdepdata:
|
if revdep2 not in taskdepdata:
|
||||||
additional.append(revdep2)
|
additional.append(revdep2)
|
||||||
next = additional
|
next = additional
|
||||||
|
|||||||
Reference in New Issue
Block a user