Stack+Heap: 12,000,000 bytes Stack in use: 1,104 bytes Heap in use: 816 bytes Program: 8,000,000 bytes In use: 1,088,080 bytes Trail: 8,000,000 bytes In use: 72 bytes Table: 4,000,000 bytes In use: 0 bytes Number of GC calls: 0 Total GC time: 0 ms Numbers of expansions: Stack+Heap(0), Program(0), Trail(0), Table(0) Number of symbols: 5332 FD backtracks: 0
| ?- statistics(Key,Value). Key = runtime Value = [633,633]?; Key = program Value = [483064,3516936]?; Key = heap Value = [364,3999604]?; Key = control Value = [32,3999604]?; Key = trail Value = [108,1999892]?; Key = table Value = [1324,1998676]?; key = gc Value = 0?; Key = backtracks V = 0 ?; Key = gc_time Value = 0 noFor all keys, the values are lists of two elements. For runtime, the first element denotes the amount of time that has elapsed since the start of Prolog, in milliseconds, and the second element denotes the amount of time that has elapsed since the previous call to statistics/2 was executed. For the key gc, the number indicates the number of times that the garbage collector has been invoked. For the key backtracks, the number indicates the number of backtracks done in the labeling of finite domain variables since B-Prolog was started. For all other keys, the first element denotes the size of the memory that is in use, and the second element denotes the size of the memory that is still available in the corresponding data area.
cputime(T):-statistics(runtime,[T|_]).
time(Goal):- cputime(Start), call(Goal), cputime(End), T is (End-Start)/1000, format(``CPU time ~w seconds. ``, [T]).
Neng-Fa Zhou 2013-01-25