[ ECLiPSe Prolog Environment built-in.|Group Index| Full Index]

set_statistics(+PredSpec, +Counters)

Initialise the statistics counters of the predicate PredSpec with the values from the list Counters.

+PredSpec
Term of the form Atom/Integer.
+Counters
List of 8 integers.

Description

There is a set of 8 counters associated with every predicate. In profiling mode they count how often the execution passed the various ports of a predicate. This built-in initialises the counters to the values given in Counters and selects PredSpec for being profiled. PredSpec's statistics-flag is set to on. The global statistics-flag is set to some, provided it was off before.

The order of the counters in the list is CALL, EXIT, TRY, CUT, NEXT, FAIL, DELAY, WAKE.

Fail Conditions

None

Resatisfiable

No

Exceptions

(4) Instantiation fault
PredSpec or Counters is not fully instantiated.
(5) Type error
PredSpec is not of the form Atom/Integer.
(5) Type error
Counters is not a list of 8 integers.
(60)
PredSpec is not a visible predicate.

Examples


Success:

    [eclipse]: set_flag(statistics, off).

    yes.
    [eclipse]: set_statistics(true/0, [10,10,0,0,0,0,0,0]).

    yes.
    [eclipse]: get_statistics(true/0, Counters).

    Counters = [10, 10, 0, 0, 0, 0, 0, 0]
    yes.
    [eclipse]: debug(true).
    Start debugging - leap mode
    Stop debugging.

    yes.
    [eclipse]: get_statistics(true/0, Counters).

    Counters = [11, 11, 0, 0, 0, 0, 0, 0]
    yes.

Error:
   set_statistics(X,[1,2,3,4,5,6,7,8]).          (Error 4)
   set_statistics(p/3,[1,2,3,_,5,6,7,8]).        (Error 4)
   set_statistics(p/3,[1,2,3,4,5,6]).            (Error 5)
   set_statistics(p/3,[1,2,3,4,5,6,a,b]).        (Error 5)
   set_statistics(unknown/3,[1,2,3,4,5,6,7,8]).  (Error 60)


See Also

get_statistics / 2, print_statistics / 0, set_flag / 3, get_flag / 3