aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-create.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-07-18 19:31:19 +0200
committerTom de Vries <tdevries@suse.de>2022-07-21 15:00:35 +0200
commitce6da2065f45708913f05c7b89d4ef329b46e1f6 (patch)
treea74f3481a2add9850706a7e20520c0e3a7256b7d /libctf/ctf-create.c
parent5c3392f9811a9cc46580401cde99337e14cab6e6 (diff)
downloadgdb-ce6da2065f45708913f05c7b89d4ef329b46e1f6.zip
gdb-ce6da2065f45708913f05c7b89d4ef329b46e1f6.tar.gz
gdb-ce6da2065f45708913f05c7b89d4ef329b46e1f6.tar.bz2
[gdbsupport] Use task size in parallel_for_each
Ensuring a fair distribution over the worker threads and main thread in terms of number of CUs might not be the most efficient way, given that CUs can vary in size. Fix this by: - adding a task_size_ptr parameter to parallel_for_each, defaulting to nullptr, - using per_cu->get_length () as the task size in the parallel_for_each in dwarf2_build_psymtabs_hard, and - using the task size in parallel_for_each to distribute similarly-sized tasks to the threads. I've used this experiment to verify the performance impact: ... $ for n in $(seq 1 10); do \ time gdb -q -batch ~/firefox/libxul.so-93.0-1.1.x86_64.debug \ 2>&1 \ | grep "real:"; \ done ... and without the patch got: ... real: 4.71 real: 4.88 real: 4.29 real: 4.30 real: 4.65 real: 4.27 real: 4.27 real: 4.27 real: 4.75 real: 4.41 ... and with the patch: ... real: 3.68 real: 3.81 real: 3.80 real: 3.68 real: 3.75 real: 3.69 real: 3.69 real: 3.74 real: 3.67 real: 3.74 ... so that seems a reasonable improvement. With parallel_for_each_debug set to true, we get some more detail about the difference in behaviour. Without the patch we have: ... Parallel for: n_elements: 2818 Parallel for: minimum elements per thread: 1 Parallel for: elts_per_thread: 704 Parallel for: elements on worker thread 0 : 705 Parallel for: elements on worker thread 1 : 705 Parallel for: elements on worker thread 2 : 704 Parallel for: elements on worker thread 3 : 0 Parallel for: elements on main thread : 704 ... and with the patch: ... Parallel for: n_elements: 2818 Parallel for: total_size: 1483674865 Parallel for: size_per_thread: 370918716 Parallel for: elements on worker thread 0 : 752 (size: 371811790) Parallel for: elements on worker thread 1 : 360 (size: 371509370) Parallel for: elements on worker thread 2 : 1130 (size: 372681710) Parallel for: elements on worker thread 3 : 0 (size: 0) Parallel for: elements on main thread : 576 (size: 367671995) ... Tested on x86_64-linux.
Diffstat (limited to 'libctf/ctf-create.c')
0 files changed, 0 insertions, 0 deletions