diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-10 15:18:31 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-13 13:52:10 +0000 |
commit | a7bbb105d33c1c85cee340ae6266609532024beb (patch) | |
tree | cc34558ab3f6208f2776e66e35545c5cf7e470da /bitbake/lib/bb | |
parent | 1a3f01cad47b67fe326bc690103bf347f587f99a (diff) | |
download | poky-a7bbb105d33c1c85cee340ae6266609532024beb.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index af11e9a8f4..c8392346a8 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -1914,6 +1914,8 @@ class RunQueueExecute: | |||
1914 | event = bb.event.StaleSetSceneTasks(found[mc]) | 1914 | event = bb.event.StaleSetSceneTasks(found[mc]) |
1915 | bb.event.fire(event, self.cooker.databuilder.mcdata[mc]) | 1915 | bb.event.fire(event, self.cooker.databuilder.mcdata[mc]) |
1916 | 1916 | ||
1917 | self.build_taskdepdata_cache() | ||
1918 | |||
1917 | def runqueue_process_waitpid(self, task, status, fakerootlog=None): | 1919 | def runqueue_process_waitpid(self, task, status, fakerootlog=None): |
1918 | 1920 | ||
1919 | # self.build_stamps[pid] may not exist when use shared work directory. | 1921 | # self.build_stamps[pid] may not exist when use shared work directory. |
@@ -2413,6 +2415,22 @@ class RunQueueExecute: | |||
2413 | ret.add(dep) | 2415 | ret.add(dep) |
2414 | return ret | 2416 | return ret |
2415 | 2417 | ||
2418 | # Build the individual cache entries in advance once to save time | ||
2419 | def build_taskdepdata_cache(self): | ||
2420 | taskdepdata_cache = {} | ||
2421 | for task in self.rqdata.runtaskentries: | ||
2422 | (mc, fn, taskname, taskfn) = split_tid_mcfn(task) | ||
2423 | pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn] | ||
2424 | deps = self.rqdata.runtaskentries[task].depends | ||
2425 | provides = self.rqdata.dataCaches[mc].fn_provides[taskfn] | ||
2426 | taskhash = self.rqdata.runtaskentries[task].hash | ||
2427 | unihash = self.rqdata.runtaskentries[task].unihash | ||
2428 | deps = self.filtermcdeps(task, mc, deps) | ||
2429 | hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn] | ||
2430 | taskdepdata_cache[task] = [pn, taskname, fn, deps, provides, taskhash, unihash, hashfn] | ||
2431 | |||
2432 | self.taskdepdata_cache = taskdepdata_cache | ||
2433 | |||
2416 | # We filter out multiconfig dependencies from taskdepdata we pass to the tasks | 2434 | # We filter out multiconfig dependencies from taskdepdata we pass to the tasks |
2417 | # as most code can't handle them | 2435 | # as most code can't handle them |
2418 | def build_taskdepdata(self, task): | 2436 | def build_taskdepdata(self, task): |
@@ -2424,16 +2442,9 @@ class RunQueueExecute: | |||
2424 | while next: | 2442 | while next: |
2425 | additional = [] | 2443 | additional = [] |
2426 | for revdep in next: | 2444 | for revdep in next: |
2427 | (mc, fn, taskname, taskfn) = split_tid_mcfn(revdep) | 2445 | self.taskdepdata_cache[revdep][6] = self.rqdata.runtaskentries[revdep].unihash |
2428 | pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn] | 2446 | taskdepdata[revdep] = self.taskdepdata_cache[revdep] |
2429 | deps = self.rqdata.runtaskentries[revdep].depends | 2447 | for revdep2 in self.taskdepdata_cache[revdep][3]: |
2430 | provides = self.rqdata.dataCaches[mc].fn_provides[taskfn] | ||
2431 | taskhash = self.rqdata.runtaskentries[revdep].hash | ||
2432 | unihash = self.rqdata.runtaskentries[revdep].unihash | ||
2433 | deps = self.filtermcdeps(task, mc, deps) | ||
2434 | hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn] | ||
2435 | taskdepdata[revdep] = [pn, taskname, fn, deps, provides, taskhash, unihash, hashfn] | ||
2436 | for revdep2 in deps: | ||
2437 | if revdep2 not in taskdepdata: | 2448 | if revdep2 not in taskdepdata: |
2438 | additional.append(revdep2) | 2449 | additional.append(revdep2) |
2439 | next = additional | 2450 | next = additional |