This module implements some predicates which provide internal control and access to the Ciao runtime, like some internal statistics, loaded modules, special properties of the predicates, garbage collection, system flags, etc.
Flags define some global parameters of the system and control the behavior of system or library predicates. Each flag has a name and an associated predefined value, and except some system flags which are fixed, in general their associated value is changeable. Predefined flags in the system are:
The state is initially error. ISO
Prints statistics about the system.
Gather information about clock ticks (either run, user, system or wall tick) since last consult or since start of program. A tick is the smallest amount of time that a clock can measure.
Gather information about frequency of the clocks used to measure the ticks (either run-user, system or wall clock). Results are returned in hertz. This value also can be defined as the amount of ticks that a clock can measure in one second.
Gather information about time (either process time or wall time) since last consult or since start of program. Results are returned in milliseconds. Note that internally, time is calculated as:
Time_result = (Tick_result / Clockfreq_result) * 1000
Gather information about memory consumption.
Gather information about garbage collection.
Gather information about number of symbols and predicates.
If Option is unbound, it is bound to the values on the other cases.
Result is a number. It gives the frequency in hertz used by the clock get the ticks.
Result is a two-element list of numbers. The first number is the number of ticks since the start of the execution; the second number is the number of ticks since the previous consult to tick.
Result is a two-element list of integers. The first one is the number of atom, functor, and predicate names in the symbol table. The second is the number of predicates known to be defined (although maybe without clauses).
Result is a tree-element list of integers, related to garbage collection and memory management. When stack_shifts is selected, the first one is the number of shifts (reallocations) of the local stack; the second is the number of shifts of the trail, and the third is the time spent in these shifts. When garbage_collection is selected, the numbers are, respectively, the number of garbage collections performed, the number of bytes freed, and the time spent in garbage collection.
Result is a two-element list of integers. The first element is the space taken up by the option selected, measured in bytes; the second integer is zero for program space (which grows as necessary), and the amount of free space otherwise.
Result is a two-element list of numbers. The first number is the time since the start of the execution; the second number is the time since the previous consult to time.
Option to get information about the number of symbols in the program.
Options to get information about garbage collection.
Options to get information about memory usage.
Options to get information about the frequency of clocks used to get the ticks.
Options to get information about execution ticks.
Options to get information about execution time. M must be one of runtime, usertime, systemtime or walltime.
Enumerates on backtracking all the existing atoms in the system.
Returns, on success, a new atom, not existing before in the system. The entry argument must be a variable. The idea behind this atom generation is to provide a fast source of identifiers for new objects, concurrent predicates, etc. on the fly.
When called using a free variable as argument, it will retrieve on backtracking all modules currently loaded. This is useful when called from the Ciao toplevel.
When called using a module name as argument it will check whether the given module is loaded or not. This is useful when called from user programs.
Retrieves (on backtracking) all the loaded modules (either statically or dynamically).
The predicate Head, visible from the current module, (a goal) has the property Property.
Forces garbage collection when called.
Set existing flag FlagName to Value.
FlagName is an existing flag, unify OldValue with the value associated with it, and set it to new value NewValue.
Same as current_prolog_flag(FlagName, OldValue). OldValue and NewValue must be strictly identical variables.
Unify Old with the current prompt for reading, change it to New.
Unify Old with the current prompt for reading without changing it. On calls, Old and New must be strictly identical variables.
Enable garbage collection. Equivalent to set_prolog_flag(gc, on)
Disable garbage collection. Equivalent to set_prolog_flag(gc, off)
Enable reporting of file errors. Equivalent to set_prolog_flag(fileerrors, on)
Disable reporting of file errors. Equivalent to set_prolog_flag(fileerrors, off)
New flags can be defined by writing facts of this predicate. Flag is the name of the new flag, Values defines the posible values for the flag (see below) and Default defines the predefined value associated with the flag (which should be compatible with Values).