libabigail/tools
Ondrej Oprala 17b04f2e04 Bug 19081 - abipkgdiff parallelization
Abipkgdiff now attempts to extract packages and compare the resulting
ELF pairs in parallel. First off, a thread is spawned to extract each
package and each debuginfo package. After the ELF files are extracted,
mapped and the threads are successfully collected, the resulting
ELF vectors are traversed to identify existing pairs and a list of
arguments for future comparison is made. This list is then sorted
by size from largest to smallest. Unless --no-parallel is
specified on the command line, MIN(pairs,active_processors) threads
are spawned, sharing a single list of arguments. This list is
processed and a map of (ELF_PATH,DIFF_CORPUS) is created. Meanwhile,
the main thread checks this same map for results in the original order
of the ELF pairs, ensuring sequential output. After all the diffing
and reporting is done, the threads are collected again.

	* doc/manuals/abipkgdiff.rst: Mention the new --no-parallel option.
	* tools/Makefile.am: Add -pthread to abipkgdiffs link options.
	* tools/abipkgdiff.cc (elf_file_paths_tls_key): New key for the
	thread-local vector of ELF filepaths.
	(reports_map): A map of the path of the first ELF of a compared pair
	and a corpus representing the difference.
	(env_map): A map of the corpus difference and a corresponding
	environment needed to be kept alive until the diff is reported.
	({arg,map}_lock): mutexes to control access to the comparison argument
	list and the {reports,env}_map respectively.
	(options): Add a new member "parallel" and set it to true in the ctor.
	(elf_file): Add a new "size" member and set it in the ctor.
	(package descriptor): Arguments passed to extract_package_set.
	(compare_args): Arguments passed to the ELF comparison function.
	(display_usage): Mention the new "--no-parallel" option.
	(pthread_routine_extract_package): A wrapper function around
	extract_package to be used in a multi-threaded environment.
	({first_second}_package_tree_walker_callback_fn): Add the new ELF file
	paths to a thread-specific vector.
	(compare): In an overload of compare, verbose output is updated to
	always mention the ELF files being compared for each reported stage.
	Reporting is no longer done in this function, the resulting difference
	is instead passed back to the calling function for reporting in the
	main thread, along with a corresponding environment.
	(pthread_routine_compare): Accept a pointer to a vector of comparison
	arguments. This function is to be called NTHREAD times and share the
	vector passed to it with its other invocations. Create the environment
	for compare() and store its output in a map if there is a difference.
	(create_maps_of_package_content): Allocate memory for a thread local
	vector of ELF paths and dispose of it before returning.
	(pthread_routine_extract_pkg_and_map_its_content): Renamed from
	extract_package_and_map_its_content. Extract the debuginfo as well as
	the regular package in this function. Spawn a separate thread for the
	extraction of the debug package.
	(pthread_join): A function handling thread joining throughout package
	extractions.
	(prepare_packages): Spawn a thread to extract each set of packages.
	(elf_size_is_greater): New comparison function used to order ELF pairs
	by size.
	(compare): In the overload of compare, pass through the ELF path
	vectors and identify pairs to be diffed. Put them in a vector and sort
	it by the summed ELF pair size. Spawn comparison threads and safely
	check for results in the proper order of the ELF pairs. Report any
	differences ASAP and collect the threads after all the reporting is
	done, checking their return status.
	(parse_command_line): Check for the "--no-parallel" option.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2015-11-10 16:04:39 +01:00
..
.gitignore Add .gitignore files. 2014-09-12 11:05:01 +02:00
abiar.cc Adjust archive-related code for the recent addition of tools_utils::* 2015-01-13 11:02:10 +01:00
abicompat.cc Introduce the concept of environment 2015-09-07 23:35:29 +02:00
abidiff.cc Adjust {s,g}et_show_stats() to use a reference 2015-09-07 23:42:17 +02:00
abidw.cc Make abidw --abidiff not show definitely harmless changes 2015-10-15 13:50:49 +02:00
abilint.cc Remove some dead code in abilint 2015-09-21 15:20:10 +02:00
abipkgdiff.cc Bug 19081 - abipkgdiff parallelization 2015-11-10 16:04:39 +01:00
abisym.cc Fix symbols comparison 2015-06-02 00:07:02 +02:00
binilint.cc Update copyright years 2015-01-07 17:52:10 +01:00
Makefile.am Bug 19081 - abipkgdiff parallelization 2015-11-10 16:04:39 +01:00