mirror of
https://git.yoctoproject.org/poky
synced 2026-09-13 18:49:33 +02:00
bitbake: runqueue: Optimize recrdepends handling
We can optimise the loops slightly so we only process given substrings once rather than many times. This means expanding out add_resolved_dependencies. Also add a function which allows replacement of the task element of a task id, reducing the amount of string handling we're doing in a performance critical loop. Its also clear that later code adds to the tasks depends so we don't need to add .depends() to extradeps at the start. (Bitbake rev: 4ad281224e92b5f94e3a9c17e8898ec8f1086cdc) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -74,6 +74,9 @@ def build_tid(mc, fn, taskname):
|
|||||||
return "multiconfig:" + mc + ":" + fn + ":" + taskname
|
return "multiconfig:" + mc + ":" + fn + ":" + taskname
|
||||||
return fn + ":" + taskname
|
return fn + ":" + taskname
|
||||||
|
|
||||||
|
def tid_replacetask(tid, taskname):
|
||||||
|
return tid.rsplit(":", 1)[0] + ":" + taskname
|
||||||
|
|
||||||
class RunQueueStats:
|
class RunQueueStats:
|
||||||
"""
|
"""
|
||||||
Holds statistics on the tasks handled by the associated runQueue
|
Holds statistics on the tasks handled by the associated runQueue
|
||||||
@@ -581,12 +584,6 @@ class RunQueueData:
|
|||||||
if t in taskData[mc].taskentries:
|
if t in taskData[mc].taskentries:
|
||||||
depends.add(t)
|
depends.add(t)
|
||||||
|
|
||||||
def add_resolved_dependencies(mc, fn, tasknames, depends):
|
|
||||||
for taskname in tasknames:
|
|
||||||
tid = build_tid(mc, fn, taskname)
|
|
||||||
if tid in self.runtaskentries:
|
|
||||||
depends.add(tid)
|
|
||||||
|
|
||||||
for mc in taskData:
|
for mc in taskData:
|
||||||
for tid in taskData[mc].taskentries:
|
for tid in taskData[mc].taskentries:
|
||||||
|
|
||||||
@@ -689,16 +686,22 @@ class RunQueueData:
|
|||||||
extradeps = {}
|
extradeps = {}
|
||||||
|
|
||||||
for taskcounter, tid in enumerate(recursivetasks):
|
for taskcounter, tid in enumerate(recursivetasks):
|
||||||
extradeps[tid] = set(self.runtaskentries[tid].depends)
|
extradeps[tid] = set()
|
||||||
|
|
||||||
tasknames = recursivetasks[tid]
|
tasknames = recursivetasks[tid]
|
||||||
seendeps = set()
|
seendeps = set()
|
||||||
|
seenbasedeps = set()
|
||||||
|
|
||||||
def generate_recdeps(t):
|
def generate_recdeps(t):
|
||||||
newdeps = set()
|
newdeps = set()
|
||||||
(mc, fn, taskname, _) = split_tid_mcfn(t)
|
basetid = fn_from_tid(t)
|
||||||
add_resolved_dependencies(mc, fn, tasknames, newdeps)
|
if basetid not in seenbasedeps:
|
||||||
extradeps[tid].update(newdeps)
|
for taskname in tasknames:
|
||||||
|
newtid = tid_replacetask(t, taskname)
|
||||||
|
if newtid in self.runtaskentries and newtid not in seendeps:
|
||||||
|
newdeps.add(newtid)
|
||||||
|
extradeps[tid].add(newtid)
|
||||||
|
seenbasedeps.add(basetid)
|
||||||
seendeps.add(t)
|
seendeps.add(t)
|
||||||
newdeps.add(t)
|
newdeps.add(t)
|
||||||
for i in newdeps:
|
for i in newdeps:
|
||||||
|
|||||||
Reference in New Issue
Block a user