A The SWI-Prolog library
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(aggregate): Aggregation operators on backtrackable predicates
        • library(ansi_term): Print decorated text to ANSI consoles
        • library(apply): Apply predicates on a list
        • library(assoc): Association lists
        • library(broadcast): Broadcast and receive event notifications
        • library(charsio): I/O on Lists of Character Codes
        • library(check): Consistency checking
        • library(clpb): CLP(B): Constraint Logic Programming over Boolean Variables
        • library(clpfd): CLP(FD): Constraint Logic Programming over Finite Domains
        • library(clpqr): Constraint Logic Programming over Rationals and Reals
        • library(csv): Process CSV (Comma-Separated Values) data
        • library(dcg/basics): Various general DCG utilities
        • library(dcg/high_order): High order grammar operations
        • library(debug): Print debug messages and test assertions
        • library(dicts): Dict utilities
        • library(error): Error generating support
        • library(exceptions): Exception classification
        • library(fastrw): Fast reading and writing of terms
        • library(gensym): Generate unique symbols
        • library(heaps): heaps/priority queues
        • library(increval): Incremental dynamic predicate modification
        • library(intercept): Intercept and signal interface
        • library(iostream): Utilities to deal with streams
        • library(listing): List programs and pretty print clauses
        • library(lists): List Manipulation
        • library(macros): Macro expansion
        • library(main): Provide entry point for scripts
        • library(nb_set): Non-backtrackable set
        • library(writef): Old-style formatted write
        • library(www_browser): Open a URL in the users browser
        • library(occurs): Finding and counting sub-terms
        • library(option): Option list processing
        • library(optparse): command line parsing
        • library(ordsets): Ordered set manipulation
        • library(pairs): Operations on key-value lists
        • library(persistency): Provide persistent dynamic predicates
        • library(pio): Pure I/O
        • library(portray_text): Portray text
        • library(predicate_options): Declare option-processing of predicates
        • library(prolog_coverage): Coverage analysis tool
        • library(prolog_debug): User level debugging tools
        • library(prolog_jiti): Just In Time Indexing (JITI) utilities
        • library(prolog_trace): Print access to predicates
        • library(prolog_versions): Demand specific (Prolog) versions
        • library(prolog_xref): Prolog cross-referencer data collection
        • library(quasi_quotations): Define Quasi Quotation syntax
        • library(random): Random numbers
        • library(rbtrees): Red black trees
        • library(readutil): Read utilities
        • library(record): Access named fields in a term
        • library(registry): Manipulating the Windows registry
        • library(rwlocks): Read/write locks
        • library(settings): Setting management
        • library(statistics): Get information about resource usage
        • library(strings): String utilities
        • library(simplex): Solve linear programming problems
        • library(solution_sequences): Modify solution sequences
        • library(tables): XSB interface to tables
        • library(tableutil): Table inspection and statistics utilities
          • table_statistics/2
          • table_statistics/3
          • table_statistics/0
          • table_statistics/1
          • table_statistics_by_predicate/0
          • table_statistics_by_predicate/1
          • tstat/2
          • tstat/3
          • tdump/0
          • tdump/1
          • tdump/2
          • tidg/0
          • tidg/1
          • summarize_idg/0
          • summarize_idg/1
        • library(terms): Term manipulation
        • library(thread): High level thread primitives
        • library(thread_pool): Resource bounded thread management
        • library(ugraphs): Graph manipulation library
        • library(url): Analysing and constructing URL
        • library(varnumbers): Utilities for numbered terms
        • library(yall): Lambda expressions
    • Packages

A.59 library(tableutil): Table inspection and statistics utilities

This library provides tools intended to be used at the interactive toplevel for inspecting tables, table dependencies and table statistics.

[nondet]table_statistics(?Stat, -Value)
[nondet]table_statistics(?Variant, ?Stat, -Value)
Give summary statistics for the tables associated with all subgoals of Variant. The table_statistics/2 version considers all tables.

The values for Stat are:

tables
Total number of answer tries
answers
Total number of answers in the combined tries
duplicate_ratio
Ratio of generated (and thus ignored) duplicate answers. 1 means no duplicates. 2 means for every answer there was (on everage) a duplicate generated.
space_ratio
Number of nodes with a value divided by the total number of nodes in a trie. The maximum is 1. A low number implies that a large amount of differently shaped data is included in the answer tries.
complete_call
Number of times answers are generated from a completed table, i.e., times answers are reused.
invalidated
Number of times an incremental table was invalidated.
reevaluated
Number of times an invalidated table wa reevaluated. If lower than invalidated this implies that dependent nodes of the IDG were reevaluated to the same answer set.
space
Summed memory usage of the answer tries in bytes.
compiled_space
Summed size for the compiled representation of completed tables.
table_statistics
Print a summary of statistics relevant to tabling.
See also
table_statistics/2 for an explanation
table_statistics(:Variant)
Print a summary for the statistics of all tables for subgoals of Variant. See table_statistics/2 for an explanation.
[det]table_statistics_by_predicate
[det]table_statistics_by_predicate(+Options)
Print statistics on memory usage and lookups per predicate. The version without options dumps all predicates without ordering. Options:
order_by(+Key)
Order the predicates according to Key. Default is tables, the number of answer tables. See table_statistics/2 for a list of values for Key.
top(N)
Only show the top N predicates.
module(Module)
Limit the results to predicates of the given module.
tstat(?Value, ?Top)
tstat(?Variant, ?Value, ?Top)
Print the top-N (for positive Top) or bottom-N (for negative Top) for Stat for all tabled subgoals of Variant (or all tabled subgoals for tstat/2). Stat is one of
answers
duplicate_ratio
space_ratio
gen(call)
space
compiled_space
See table_statistics/2.
deadlock
Times this table was involved in a deadlock (cycle of threads waiting for each others table to complete)
wait
Times a thread waited for this table.
variables
The number of variables in the variant. The tabling logic adds a term ret(...) to the table for each answer, where each variable is an argument of the ret(...) term. The arguments are placed in depth-first lef-right order they appear in the variant. Optimal behaviour of the trie is achieved if the variance is as much as possible to the rightmost arguments. Poor allocation shows up as a low space_ratio statistics.

Below are some examples

[det]tdump
[det]tdump(:Goal)
[det]tdump(:Goal, +Options)
Dump all tables and their status that unify with Goal. Options:
scope(Scope)
Limit displayed tables to local or global.
limit(Count)
Limit the number of answers displayed to Count
reset(Boolean)
If true, also show reset (fresh) global tables. These are tables that have been abolished.
[det]tidg
[det]tidg(:Goal)
Dump the incremental dependency graph. idg/1 dumps the graph around a given node
[det]summarize_idg
[det]summarize_idg(+TopN)
Implements XSB's statistics(summarize_idg)