Module Statistics

This module provides some execution statistics. The predicate statistics/2 returns some key figures of the memory management and the runtime system, whereas the predicate statistics/0 displays the key figures on the standard output. The measurement of the time performance of a goal is facilitated by the predicate time/1.

?- statistics.
Max Memory             512,753,664 Bytes
Used Memory             68,568,872 Bytes
Free Memory            444,184,792 Bytes
Uptime                      5,293 Millis
GC Time                        12 Millis
Threads Time              1,000 Millis
Current Time           02/13/18 15:20:08
The threads managed by a thread are determined from the thread groups owned by the thread. The managed time is determined from managed threads that are already dead, whereas the snapshot time is determined from managed threads that are still alive. The CPU time is determined from summing the thread, managed and snapshot CPU time..

The following stats predicates are provided:

The predicate displays the current statistics key value pairs.
statistics(K, V):
The predicate succeeds for the values V of the keys K. The following keys are returned by the predicate:
max: The maximum memory in bytes.
used: The currently used memory in bytes.
free: The currently allocated but unused memory in bytes.
uptime: The time since start-up in milliseconds.
gctime: The time spent for garbage collection in milliseconds.
time: The CPU time of the current thread.
sys_time_self: The thread CPU time of the current thread.
sys_time_managed: The managed CPU time of the current thread.
sys_time_snapshot: The snapshot CPU time of the current threads.
wall: The current time in milliseconds.
The predicate succeeds whenever the goal A succeeds. The predicate will measure the time for the execution of the goal A irrespective of whether the goal A succeeds or fails. Redoing the goal A is measured when the goal A has left some choice points.
thread_statistics(T, K, V):
The predicate for the values V of the keys K concerning the thread T. The following keys are returned by the predicate.
sys_local_clauses: The number of thread local clauses.
sys_time_self: The thread CPU time.
sys_time_managed: The managed CPU time.