Home Contents Index Summary Previous Next

3.40 Obtaining Runtime Statistics

statistics(+Key, -Value)
Unify system statistics determined by Key with Value. The possible keys are given in the table 4.

cputime(User) CPU time since Prolog was started in seconds
inferencesTotal number of passes via the call and redo ports since Prolog was started.
heapEstimated total size of the heap (see section 2.15.1.1)
heapusedBytes heap in use by Prolog.
heaplimitMaximum size of the heap (see section 2.15.1.1)
localAllocated size of the local stack in bytes.
localusedNumber of bytes in use on the local stack.
locallimitSize to which the local stack is allowed to grow
globalAllocated size of the global stack in bytes.
globalusedNumber of bytes in use on the global stack.
globallimitSize to which the global stack is allowed to grow
trailAllocated size of the trail stack in bytes.
trailusedNumber of bytes in use on the trail stack.
traillimitSize to which the trail stack is allowed to grow
atomsTotal number of defined atoms.
functorsTotal number of defined name/arity pairs.
predicatesTotal number of predicate definitions.
modulesTotal number of module definitions.
codesTotal amount of byte codes in all clauses.
Table 4 : Keys for statistics/2

statistics
Display a table of system statistics on the current output stream.

time(+Goal)
Execute Goal just like once/1 (i.e. leaving no choice points), but print used time, number of logical inferences and the average number of lips (logical inferences per second). Note that SWI-Prolog counts the actual executed number of inferences rather than the number of passes through the call- and redo ports of the theoretical 4-port model.