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

print_modes

Prints the results of the mode statistics as a mode declaration.

Description

This predicate prints the statistics about the argument modes called in the profiling session. The output is printed in the form of a mode declaration which can be directly read in and executed by ECLiPSe . At the beginning of the profiling, the modes for each predicate are initialized to the predicate's mode declaration. During the profiling session, these modes are updated with every call, and the resulting mode is remembered. This means that if the predicate has a mode declaration which contains at least one argument different from ?, the resulting modes can be only weaker, i.e. more general, than the declaration. Only if the predicate has no mode declaration, modes corresponding exactly to the profiled program are recorded.

Note The statistics package records mode '--' when the corresponding argument was not instantiated, however this condition is not enough for the output mode - an output mode argument must not be a suspending variable and it must not occur in other arguments of the call. Therefore for some procedures the mode declaration printed by print_modes/0 will not be correct and the program might not run with it.

Fail Conditions

Fails if the statistics flag is not equal to mode.

Resatisfiable

No.

Exceptions

Examples


Success:
    [eclipse]: [nrev].
    /home/eclipse/nrev.sd       loaded 2928 bytes in 0.07 seconds

     yes.
    [eclipse]: set_flag(statistics, mode),
            debug(nreverse([1,2,3], _)).
    Start debugging - leap mode
    Stop debugging.

    yes.
    [eclipse]: print_modes.
    :- mode
              nreverse(++, -),
              append(++, ++, -).

Fail:
    set_flag(statistics, all), print_modes.


See Also

compile / 1, mode / 1, get_flag / 3, set_flag / 3, print_statistics / 0, set_statistics / 2