A.38.2 Combining coverage data from multiple runs
The coverage tools allow both combining data from running multiple queries as combining data from multiple Prolog processes.
For multiple queries in the same process, coverage data may be collected using coverage/1 which, unlike coverage/2, does not change the non-deterministic semantics of the Goal and adds to the already collected data. If no current collection is in progress, the currently collected data can be displayed using show_coverage/1.
Coverage data may be saved to a file using cov_save_data/2.
Saved data can be reloaded using cov_load_data/2.
Data from multiple Prolog runs can be combined in the same file using cov_save_data/2
with the
append(true)
option. When possible, file locking is used to
ensure that concurrect processes can safely use the same data file. The
result can be shown by loading the code that was relevant to all runs,
use
cov_load_data/2
and show the result using show_coverage/1.
Note that saving an loading the coverage data saves and restores references to the clauses as the Nth clause of a predicate defined in a specific file. This implies that the program must be loaded in exactly the same way, including optimization level, term/goal expansion and order of multifile predicates.