Next: , Previous: , Up: mpg-bpr   [Contents][Index]


11.3.217 statistics/[0,2]

Synopsis

statistics

Displays statistics relating to memory usage and execution time.

statistics(?Keyword, ?List)

Obtains individual statistics.

Arguments

Keyword

atom

Statistics key (see ref-mgc-ove-sta).

List

list of integer

List of statistics.

Description

statistics/0 displays various statistics relating to memory usage, runtime and garbage collection, including information about which areas of memory have overflowed and how much time has been spent expanding them. The printing is handled by print_message/2.

Garbage collection statistics are initialized to zero when a Prolog session starts. The statistics increase until the session is over.

statistics/2 is usually used with Keyword instantiated to a keyword such as runtime and List unbound. The predicate then binds List to a list of statistics related to the keyword. It can be used in programs that depend on current runtime statistical information for their control strategy, and in programs that choose to format and write out their own statistical summaries.

Exceptions

type_error
domain_error

Invalid keyword.

Examples

To report information on the runtime of a predicate p/0, add the following to your program:

:- statistics(runtime, [T0|_]),
   p, 
   statistics(runtime, [T1|_]), 
   T is T1 - T0,
   format('p/0 took ~3d sec.~n', [T]).

See Also

ref-mgc-ove-sta, ref-msg.


Send feedback on this subject.