]> git.ipfire.org Git - thirdparty/elfutils.git/commit
src/readelf.c: Support concurrency for -w, --debug-dump
authorAaron Merey <amerey@redhat.com>
Tue, 5 Aug 2025 03:20:54 +0000 (23:20 -0400)
committerAaron Merey <amerey@redhat.com>
Tue, 12 Aug 2025 13:27:09 +0000 (09:27 -0400)
commit78b944f482395d10d8e62ee8ed468e5fdf23efdf
tree70afa056999179fadefa6abe03a3cff7df266817
parentf74cf4b240a581312a4ba107d137cdbb80b68735
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