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 perfor-mance of a goal is facilitated by the predicate time/1.

Example:
?- 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
Thread Cpu Time             1,000 Millis
Current Time           02/13/18 15:20:08

Since Jekejeke Prolog is a multi-threaded interpreter, we also provide statistics for the threads in JVM known to the interpreter. The predicate thread_statistics/3 returns some key figures concerning the given thread, whereas the predicate threads/0 displays the key figures for all known threads on the standard output.

Example:
?- threads.
Id      Alive Clauses    
     21 Yes              0
     25 Yes      1,256,856

The JVM will notify the Prolog interpreter about low memory. On the Android platform this is a suicide notice, since foreground heap compaction is not yet available and it is therefore recommended to exit the Prolog interpreter. On both the Swing and the Android platforms the thread statistics are then used to decide which thread will be aborted.

The following stats predicates are provided:

statistics:
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 time spent by this Jekejeke Prolog thread.
wall: The current time in milliseconds.
time(A):
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_thread_local_clauses: The number of thread local clauses.
threads:
The predicate displays the current threads statistics key value pairs.

Comments