summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/runqueue.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-26 11:50:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-02-06 11:06:30 +0000
commit2ae62f0d2b4f130a12b4b3bed38a9cd82a5bb6cf (patch)
tree287a56c0c6f1f4fb95497309bd5049e261207e53 /bitbake/lib/bb/runqueue.py
parent38fd8bbb7fdd84026466af4e38f9ace69be1cb8b (diff)
downloadpoky-2ae62f0d2b4f130a12b4b3bed38a9cd82a5bb6cf.tar.gz
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>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-rw-r--r--bitbake/lib/bb/runqueue.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 5f53fe79fe..bbfe9eeee0 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -74,6 +74,9 @@ def build_tid(mc, fn, taskname):
74 return "multiconfig:" + mc + ":" + fn + ":" + taskname 74 return "multiconfig:" + mc + ":" + fn + ":" + taskname
75 return fn + ":" + taskname 75 return fn + ":" + taskname
76 76
77def tid_replacetask(tid, taskname):
78 return tid.rsplit(":", 1)[0] + ":" + taskname
79
77class RunQueueStats: 80class RunQueueStats:
78 """ 81 """
79 Holds statistics on the tasks handled by the associated runQueue 82 Holds statistics on the tasks handled by the associated runQueue
@@ -581,12 +584,6 @@ class RunQueueData:
581 if t in taskData[mc].taskentries: 584 if t in taskData[mc].taskentries:
582 depends.add(t) 585 depends.add(t)
583 586
584 def add_resolved_dependencies(mc, fn, tasknames, depends):
585 for taskname in tasknames:
586 tid = build_tid(mc, fn, taskname)
587 if tid in self.runtaskentries:
588 depends.add(tid)
589
590 for mc in taskData: 587 for mc in taskData:
591 for tid in taskData[mc].taskentries: 588 for tid in taskData[mc].taskentries:
592 589
@@ -689,16 +686,22 @@ class RunQueueData:
689 extradeps = {} 686 extradeps = {}
690 687
691 for taskcounter, tid in enumerate(recursivetasks): 688 for taskcounter, tid in enumerate(recursivetasks):
692 extradeps[tid] = set(self.runtaskentries[tid].depends) 689 extradeps[tid] = set()
693 690
694 tasknames = recursivetasks[tid] 691 tasknames = recursivetasks[tid]
695 seendeps = set() 692 seendeps = set()
693 seenbasedeps = set()
696 694
697 def generate_recdeps(t): 695 def generate_recdeps(t):
698 newdeps = set() 696 newdeps = set()
699 (mc, fn, taskname, _) = split_tid_mcfn(t) 697 basetid = fn_from_tid(t)
700 add_resolved_dependencies(mc, fn, tasknames, newdeps) 698 if basetid not in seenbasedeps:
701 extradeps[tid].update(newdeps) 699 for taskname in tasknames:
700 newtid = tid_replacetask(t, taskname)
701 if newtid in self.runtaskentries and newtid not in seendeps:
702 newdeps.add(newtid)
703 extradeps[tid].add(newtid)
704 seenbasedeps.add(basetid)
702 seendeps.add(t) 705 seendeps.add(t)
703 newdeps.add(t) 706 newdeps.add(t)
704 for i in newdeps: 707 for i in newdeps: