From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] taskdata: Add gettask_id_fromfnid helper function
Date: Wed, 27 Jun 2012 11:04:06 +0100 [thread overview]
Message-ID: <1340791446.23146.12.camel@ted> (raw)
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.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 03766ad..e09e8c8 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -406,9 +406,8 @@ class RunQueueData:
depdata = taskData.build_targets[depid][0]
if depdata is None:
continue
- dep = taskData.fn_index[depdata]
for taskname in tasknames:
- taskid = taskData.gettask_id(dep, taskname, False)
+ taskid = taskData.gettask_id_fromfnid(depdata, taskname)
if taskid is not None:
depends.append(taskid)
@@ -419,9 +418,8 @@ class RunQueueData:
depdata = taskData.run_targets[depid][0]
if depdata is None:
continue
- dep = taskData.fn_index[depdata]
for taskname in tasknames:
- taskid = taskData.gettask_id(dep, taskname, False)
+ taskid = taskData.gettask_id_fromfnid(depdata, taskname)
if taskid is not None:
depends.append(taskid)
@@ -469,8 +467,7 @@ class RunQueueData:
# Won't be in build_targets if ASSUME_PROVIDED
depdata = taskData.build_targets[depid][0]
if depdata is not None:
- dep = taskData.fn_index[depdata]
- taskid = taskData.gettask_id(dep, idependtask, False)
+ taskid = taskData.gettask_id_fromfnid(depdata, idependtask)
if taskid is None:
bb.msg.fatal("RunQueue", "Task %s in %s depends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep))
depends.append(taskid)
@@ -482,8 +479,7 @@ class RunQueueData:
# Won't be in run_targets if ASSUME_PROVIDED
depdata = taskData.run_targets[depid][0]
if depdata is not None:
- dep = taskData.fn_index[depdata]
- taskid = taskData.gettask_id(dep, idependtask, False)
+ taskid = taskData.gettask_id_fromfnid(depdata, idependtask)
if taskid is None:
bb.msg.fatal("RunQueue", "Task %s in %s rdepends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep))
depends.append(taskid)
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py
index 8bc447c..55cdde5 100644
--- a/bitbake/lib/bb/taskdata.py
+++ b/bitbake/lib/bb/taskdata.py
@@ -116,6 +116,16 @@ class TaskData:
ids.append(self.tasks_lookup[fnid][task])
return ids
+ def gettask_id_fromfnid(self, fnid, task):
+ """
+ Return an ID number for the task matching fnid and task.
+ """
+ if fnid in self.tasks_lookup:
+ if task in self.tasks_lookup[fnid]:
+ return self.tasks_lookup[fnid][task]
+
+ return None
+
def gettask_id(self, fn, task, create = True):
"""
Return an ID number for the task matching fn and task.
reply other threads:[~2012-06-27 10:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1340791446.23146.12.camel@ted \
--to=richard.purdie@linuxfoundation.org \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox