
statistics(?Keyword, -Value)

   Succeeds if the statistics item Keyword has value Value.



Arguments
   Keyword             Atom or Variable.
   Value               Prolog term.

Type
   Development Environment and Global Settings

Description
   Used to retrieve various statistical information about the running
   ECLiPSe .  To print a list of all the current values, statistics/0 can
   be used.


   The following list details the statistic items:


control_stack_allocated


    Unit :  bytes


    Description : The amount of control stack currently allocated. The
        control stack is allocated in chunks, up to a maximum controlled by
        the -l command line option. The local and control stacks share the
        same memory area specified by the -l option, which thus gives the
        maximum combined allocated size of these two stacks.

control_stack_peak


    Unit : bytes


    Description :   The peak allocated size of the control stack during
        this session. Chunks of memory can be allocated to, and
        deallocated from, the control stack as it grows and shrinks.

control_stack_used


    Unit :   bytes


    Description :   The amount of control stack currently in use.  This
        stack holds information needed for backtracking.  

cputime


    Unit :   seconds (float)


    Description :   Returns the cpu time of the calling thread,
        the same as cputime/1.

dictionary_entries


    Unit :   count


    Description :   The number of atoms and functors that are currently
        known to the system.  This is equal to the number of solutions
        that current_functor/1 would return.

dict_hash_usage


    Type :  pair of integers Used/Avail


    Description :   Returns two numbers: the number of actually used slots
        in the dictionary hash table, versus the number of available slots.

dict_hash_collisions


    Type :  pair of integers Collisions/Entries


    Description :   Returns two numbers: the number of dictionary entries 
        that collided with existing hash table entries, versus the total
        number of dictionary hash table entries.

dict_gc_number


    Unit :   count


    Description :   The number of dictionary garbage collections performed
        during this session. 

dict_gc_countdown


    Unit :   count


    Description :   The number of new dictionary entries that can be
        created before the next dictionary garbage collection is triggered.

dict_gc_running


    Unit :   atomic constant 'false' or 'true'


    Description :   When 'true', a dictionary garbage collection is
        currently under way.  This can occur in applications with
        multiple engine threads, while some engines have not yet
        finished (or are prevented from performing) their share of
        garbage collection activity.

event_time


    Unit :   seconds (float)


    Description :   Returns the elapsed real time (session_time) or 
        the elapsed user time (cputime) since the start of a 
        (parallel) ECLiPSe session depending on the value of the 
        after_event_timer flag.  

gc_area


    Unit :   bytes


    Description :   The average area processed by a garbage collection.
        This number should be close to the value of gc_interval.  If it
        is much higher, gc_interval should be increased.

gc_collected


    Unit :   bytes (float)


    Description :   The total number of bytes collected in the global
        stack during all the garbage collections in this session.  This
        value is a float, to avoid overflow.

gc_number


    Unit :   count


    Description :   The number of global/trail stack garbage
        collections performed during this session.

gc_ratio


    Unit :   percent (float)


    Description :   The average percentage of garbage found and
        collected in the garbage collections performed so far.  If this
        number is low, gc_interval should be increased.

gc_time


    Unit :   seconds (float)


    Description :   The total time spent for all garbage collections in
        this session.

private_heap_allocated


    Unit :   bytes


    Description :   The amount of memory assigned to the private heap.
        This area will never shrink.

private_heap_used


    Unit :   bytes


    Description :   The amount of memory currently used for private
        data.

global_stack_allocated


    Unit :   bytes


    Description :   The amount of global stack currently allocated. The
        global stack is allocated in chunks, up to a maximum controlled
        by the -g command line option. The global stack and trail share the
        same memory area specified by the -g option, which thus gives the
        maximum possible combined allocated size of these two stacks.

global_stack_peak


    Unit :   bytes


    Description :   The peak allocated size of the global stack during
        this session. Chunks of memory can be allocated to, and
        deallocated from, the global stack as it grows and shrinks.

global_stack_used


    Unit :   bytes


    Description :   The amount of global stack currently in use.  The
        global stack holds lists and structures and is subject to
        garbage collection.

hr_time


    Unit :   seconds (float)


    Description :   Returns the value of a high-resolution timer in seconds.
        The precise meaning of this value is operating system and hardware
        dependent, but the resolution should be better than the other time
        statistics, usually in the microsecond range.  Only the difference
        between two such times is meaningful, the absolute value does not
        have any specific meaning.  If operating system or hardware do not
        provide such a timer, the value is the same as session_time.

local_stack_allocated


    Unit :   bytes


    Description : The amount of local stack currently allocated. The local
        stack is allocated in chunks, up to a maximum controlled by the -l
        command line option. The local and control stacks share the same
        memory area specified by the -l option, which thus gives the
        maximum combined allocated size of these two stacks.

local_stack_peak


    Unit :   bytes


    Description :   The peak allocated size of the local stack during
        this session. Chunks of memory can be allocated to, and
        deallocated from, the local stack as it grows and shrinks.

local_stack_used


    Unit :   bytes


    Description :   The amount of local stack currently in use.  This
        stack holds Prolog variables and return addresses.  

global_stack


    Unit :   List of bytes


    Description : Returns a list of two numbers for the allocated global
       stack: the number of bytes currently used, and the number of bytes
       currently free. It is provided mainly for compatibility.

local_stack


    Unit :   List of bytes


    Description : Returns a list of two numbers on the current usage of the
       allocated local and control stacks. In the original WAM, these two
       stacks are combined into a single stack. This is provided for
       compatibility purposes only.

trail


    Unit :   List of bytes


    Description : Returns a list of two numbers for the allocated trail:
        the number of bytes currently used, and the number of bytes
        currently free. It is provided mainly for compatibility.

runtime


    Unit :   List of milliseconds (integers)


    Description :   Returns a list of two times:  user cpu time since
        the start of the ECLiPSe session, user cpu time since the last
        call to statistics(runtime, _). As from ECLiPSe 4.2, these times
        exclude the time spent in garbage collection. This item is provided
        primarily for compatibility reasons.

session_time


    Unit :   seconds (float)


    Description :   Returns the real time elapsed since the start of a
        (parallel) ECLiPSe session.  This is the only timer that can be
        reliably used in a parallel execution, since it accesses a
        central clock.  All other timers are local to the worker where
        they are accessed.

shared_heap_allocated


    Unit :   bytes


    Description :   The amount of memory assigned to the code heap, i.e.
        the area used for storing compiled Prolog code, atoms, records,
        non-logical variables, descriptors, buffers etc.  This area will
        never shrink.

shared_heap_used


    Unit :   bytes


    Description :   The amount of memory currently used for compiled
        Prolog code, atoms, records, non-logical variables, descriptors,
        buffers etc.

times


    Unit :   List of seconds (floats)


    Description :   Returns a list of three times:  user cpu time,
        system cpu time and real time elapsed since the start of the
        ECLiPSe session.  The cpu times are for the whole process,
        i.e. all threads together.  Therefore, in multithreaded programs,
        process cpu time can be much higher than elapsed real time.
        For thread cpu time, see statistics(cputime,T) and cputime/1.

trail_stack_allocated


    Unit :   bytes


    Description : The amount of trail stack currently allocated. The trail
        is allocated in chunks, up to a maximum controlled by the -g
        command line option. The global stack and trail share the same
        memory area specified by the -g option, which thus gives the
        maximum possible combined allocated size of these two stacks.

trail_stack_peak


    Unit :   bytes


    Description : The peak allocated size of the trail stack during
        this session. Chunks of memory can be allocated to, and
        deallocated from, the trail stack as it grows and shrinks.

trail_stack_used


    Unit :   bytes


    Description :   The amount of trail stack currently in use.  The
        trail stack records information needed for backtracking and is
        subject to garbage collection.

wake_count


    Unit :   count


    Description :   The number of times suspensions (delayed goals)
        were woken up.  This is an indicator for the activity of the
	constraints in a constraint program (but says nothing about
	whether this activity achieved any domain propagation or
	search space reduction).


NOTE: library(quintus) contains a compatibility version of statistics/2
which accepts the following different keywords:  runtime, system_time,
real_time, walltime, memory, program, global_stack,  local_stack, trail,
choice, stacks, garbage_collection, stack_shifts, atoms,
atom_garbage_collection, core, heap.


Modes and Determinism
   statistics(-, -) is multi
   statistics(+, -) is det

Exceptions
     5 --- Keyword is neither an atom nor variable.

Examples
   
Success:
   [eclipse]: statistics(times, [_,_,T]).
   T = 2848.64
   yes.
   [eclipse]: statistics(global_stack_used, G).
   G = 136
   yes.
Fail:
   statistics(times, [T]).
Error:
   statistics("time", T).    (Error 5)






See Also
   set_flag / 2, env / 0, statistics / 0
