diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-27 11:04:06 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-28 16:32:57 +0100 |
commit | edfb2ba32c5075e2df338a549021c634659f3225 (patch) | |
tree | d70d1d5e36362ae3c14ca7e05f86df11e67b5a73 | |
parent | d498bd6bf34c6dd65e24ec32d425742f42152cae (diff) | |
download | poky-edfb2ba32c5075e2df338a549021c634659f3225.tar.gz |
bitbake: taskdata: Add gettask_id_fromfnid helper function
This is like gettask_id but doesn't require translation of fnid -> fn
first which the function then translates back. This gives a sizeable
performance improvement since a significant number of lookups are avoided.
(Bitbake rev: 3190cb83e2af195a464f669c5aa8aedbf795160e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 12 | ||||
-rw-r--r-- | bitbake/lib/bb/taskdata.py | 10 |
2 files changed, 14 insertions, 8 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 03766adfea..e09e8c8080 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -406,9 +406,8 @@ class RunQueueData: | |||
406 | depdata = taskData.build_targets[depid][0] | 406 | depdata = taskData.build_targets[depid][0] |
407 | if depdata is None: | 407 | if depdata is None: |
408 | continue | 408 | continue |
409 | dep = taskData.fn_index[depdata] | ||
410 | for taskname in tasknames: | 409 | for taskname in tasknames: |
411 | taskid = taskData.gettask_id(dep, taskname, False) | 410 | taskid = taskData.gettask_id_fromfnid(depdata, taskname) |
412 | if taskid is not None: | 411 | if taskid is not None: |
413 | depends.append(taskid) | 412 | depends.append(taskid) |
414 | 413 | ||
@@ -419,9 +418,8 @@ class RunQueueData: | |||
419 | depdata = taskData.run_targets[depid][0] | 418 | depdata = taskData.run_targets[depid][0] |
420 | if depdata is None: | 419 | if depdata is None: |
421 | continue | 420 | continue |
422 | dep = taskData.fn_index[depdata] | ||
423 | for taskname in tasknames: | 421 | for taskname in tasknames: |
424 | taskid = taskData.gettask_id(dep, taskname, False) | 422 | taskid = taskData.gettask_id_fromfnid(depdata, taskname) |
425 | if taskid is not None: | 423 | if taskid is not None: |
426 | depends.append(taskid) | 424 | depends.append(taskid) |
427 | 425 | ||
@@ -469,8 +467,7 @@ class RunQueueData: | |||
469 | # Won't be in build_targets if ASSUME_PROVIDED | 467 | # Won't be in build_targets if ASSUME_PROVIDED |
470 | depdata = taskData.build_targets[depid][0] | 468 | depdata = taskData.build_targets[depid][0] |
471 | if depdata is not None: | 469 | if depdata is not None: |
472 | dep = taskData.fn_index[depdata] | 470 | taskid = taskData.gettask_id_fromfnid(depdata, idependtask) |
473 | taskid = taskData.gettask_id(dep, idependtask, False) | ||
474 | if taskid is None: | 471 | if taskid is None: |
475 | bb.msg.fatal("RunQueue", "Task %s in %s depends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep)) | 472 | bb.msg.fatal("RunQueue", "Task %s in %s depends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep)) |
476 | depends.append(taskid) | 473 | depends.append(taskid) |
@@ -482,8 +479,7 @@ class RunQueueData: | |||
482 | # Won't be in run_targets if ASSUME_PROVIDED | 479 | # Won't be in run_targets if ASSUME_PROVIDED |
483 | depdata = taskData.run_targets[depid][0] | 480 | depdata = taskData.run_targets[depid][0] |
484 | if depdata is not None: | 481 | if depdata is not None: |
485 | dep = taskData.fn_index[depdata] | 482 | taskid = taskData.gettask_id_fromfnid(depdata, idependtask) |
486 | taskid = taskData.gettask_id(dep, idependtask, False) | ||
487 | if taskid is None: | 483 | if taskid is None: |
488 | bb.msg.fatal("RunQueue", "Task %s in %s rdepends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep)) | 484 | bb.msg.fatal("RunQueue", "Task %s in %s rdepends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep)) |
489 | depends.append(taskid) | 485 | depends.append(taskid) |
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py index 8bc447c11c..55cdde553b 100644 --- a/bitbake/lib/bb/taskdata.py +++ b/bitbake/lib/bb/taskdata.py | |||
@@ -116,6 +116,16 @@ class TaskData: | |||
116 | ids.append(self.tasks_lookup[fnid][task]) | 116 | ids.append(self.tasks_lookup[fnid][task]) |
117 | return ids | 117 | return ids |
118 | 118 | ||
119 | def gettask_id_fromfnid(self, fnid, task): | ||
120 | """ | ||
121 | Return an ID number for the task matching fnid and task. | ||
122 | """ | ||
123 | if fnid in self.tasks_lookup: | ||
124 | if task in self.tasks_lookup[fnid]: | ||
125 | return self.tasks_lookup[fnid][task] | ||
126 | |||
127 | return None | ||
128 | |||
119 | def gettask_id(self, fn, task, create = True): | 129 | def gettask_id(self, fn, task, create = True): |
120 | """ | 130 | """ |
121 | Return an ID number for the task matching fn and task. | 131 | Return an ID number for the task matching fn and task. |