11.3.160 print_coverage/[0,1] [development]

Synopsis

print_coverage

Prints the coverage data accumulated so far, to the current output stream, in a hierarchical format.

print_coverage(+Data)

Prints the coverage data Data, to the current output stream, in a hierarchical format. Data should be of type list of coverage_pair; see coverage_data/1.

Arguments

Data
list of coverage_pair

Description

The output is formatted hierarchically into blocks of lines, one block per source file. A typical block looks like:

     /home/matsc/tmp/primes.pl
         user:integers/3
             clause 1
                5:        100
                8:         99
             clause 2
                9:          1
         user:primes/2
             clause 1
                1:          1
                2:          1
                3:         *1
         user:remove/3
             clause 1
               16:        436
             clause 2
               17:        411
               20:       *337
             clause 3
               21:         74
               22:        *74
         user:sift/2
             clause 1
               11:          1
             clause 2
               12:         25
               13:        *25
               14:        *25

This block lists all the coverage sites for the given file. They are distributed over 4 predicates, 8 clauses, and 16 active lines of code. The coverage site on line 8 was hit 99 times. The coverage site on line 20 was hit 337 times, making at least one nondet call. And so on.

The variant print_coverage/1 is useful e.g. if you want to somehow filter the execution coverage computed by coverage_data/1 before printing it.

See Also

Coverage Analysis. The Emacs interface has commands for code coverage highlighting of the current buffer (C-c C-o, or use the Prolog menu; see Usage).


Send feedback on this subject.