]> git.ipfire.org Git - thirdparty/elfutils.git/commit
src/readelf.c: Support concurrency for -w, --debug-dump
authorAaron Merey <amerey@redhat.com>
Mon, 30 Jun 2025 03:51:58 +0000 (23:51 -0400)
committerAaron Merey <amerey@redhat.com>
Thu, 3 Jul 2025 18:18:18 +0000 (14:18 -0400)
commit7159dc3fb43fda5134461d861566ae311478231b
treeb28ada7eb8fbf80354f6f5e175d47a29d338ec62
parent2667a6e05b1c669953f6843a2f447e6b3b692047
src/readelf.c: Support concurrency for -w, --debug-dump

Implement concurrent execution of print_debug_* functions during handling
of -w, --debug-dump using libthread.a.

A new `-C, --concurrency=NUM` command line option controls the maximum
number of threads that may be used. This value defaults to the number of CPUs.

Job output is buffered and printed in the order that jobs were added to
the queue. This helps preserve the existing order of stdout output.

* src/readelf.c (default_concurrency): Function estimating the
maximum number of threads.
(parse_opt): Handle -C, --concurrency=NUM.
(do_job): Entry point function for threads.
(schedule_job): If thread safety is enabled, add job to the
job queue.  Otherwise just run the job from the main thread.
(print_debug): Pass print_debug_* function pointers and
args to schedule_job. Also call run_jobs if thread safety
is enabled.

Signed-off-by: Aaron Merey <amerey@redhat.com>
src/readelf.c