Once compiled, predicates can be called as usual and will (by default) have no visible side effects. Internally however, the counters will be incremented as the execution progresses. The following demonstrates this for a single solution to the queen predicate:?- coverage:ccompile(queen). queen.ecl compiled traceable 6016 bytes in 0.01 seconds coverage: inserted 20 coverage counters into module queen Yes (0.14s cpu)
The counter results are retrieved as demonstrated in the subsequent section. The two argument predicate ccompile/2 can take a list of name:value pairs which can be used to control the exact manner in which coverage counters are inserted. The documentation for the ccompile/2 predicate provides for a full list of the available flags.?- queen:queen([1,2,3,4,5,6,7,8,9], Out).
This creates the result file coverage/queens.html which can be viewed using any browser. It contains a pretty-printed form of the source, annotated with the values of the code coverage counters as described above. As a side effect, the coverage counters will be reset.?- coverage:result(queen). Writing /examples/coverage/queen.html index.pl compiled traceable 335304 bytes in 0.17 seconds Yes (0.18s cpu)