spyallows one to trace the execution of a query in a selective manner. If you want to find out about each time that a particular predicate is called, you
spythat predicate: see example below.
?- listing(happy). happy(A) :- rich(A). true. ?- listing(rich). rich(fred). true. ?- spy(rich). % Spy point on rich/1 true. [debug] ?- happy(fred). Call: (8) rich(fred) ? creep Exit: (8) rich(fred) ? creep Exit: (7) happy(fred) ? creep true.
As you can see, the call to rich is traced, but not much else.
trace, which traces
the execution of everything.
Turn spying off with
[debug] ?- nospy(rich). % Spy point removed from rich/1 true.