Detailed tabling statistics

Hi. I’m wondering if there is some predicate that can display detailed informations about tabling. Something like statistics/2 with a key for tabling. For instance, in XSB, statistics/0 displays also informations about tabling. I cannot see something similar in SWI Prolog.

Thanks.

Not really. You can enumerate the tries and get some statistics on them. Tabling is much in flux. I am very much interested in peoples practical experience, also to know where to put priorities. What are you looking for?

Something interesting could be for instance the memory usage or the number of time a tabled predicate is called during the resolution.

You can get a reasonable view on the memory usage using the predicates to find the answer tries and use trie_property/2 to find the memory usage of each trie. Would be nice to write some utilities on top of that. I already have some in my private library, but memory consumption is not on the top of my agenda right now. These are correctness and performance.

To find calls, simply use the profiler. The interesting part is the number of suspensions that are restarted. These are in call_continuation/1, but it would be interesting to have timings on the various continuations individually. That is not easily accessible. Still, the profiler gives a lot of information, also to figure out what goes on inside tabling.

1 Like

Is there any example on how to use trie and relative predicates such as trie_property? I’ve looked into the documentation but i didn’t get how to use it, thanks!

Try

?- current_table(M:H, Table),
   trie_property(Table, size(Bytes)).

Note that current_table/2 has a bit odd semantics, interpreting H as a variant if it is non-var and as a pattern to access all tables if it is var. Most likely these will be replaced by the table predicates from XSB that are available in library(dialect/xsb/tables)