clara.tools.tracing

Support for tracing state changes in a Clara session.

get-trace

(get-trace session)

Returns the trace from the given session.

is-tracing?

(is-tracing? session)

Returns true if the given session has tracing enabled, false otherwise.

listener->trace

(listener->trace listener)

ranked-productions

(ranked-productions session)

Given a session with tracing enabled, return a map of rule and query names to a numerical index that represents an approximation of the proportional amount of times Clara performed processing related to this rule. This is not intended to have a precise meaning, and is intended solely as a means to provide a rough guide to which rules and queries should be considered the first suspects when diagnosing performance problems in rules sessions. It is possible for a relatively small number of interactions to take a long time if those interactions are particularly costly. It is expected that the results may change between different versions when Clara’s internals change, for example to optimize the rules network. Nevertheless, it is anticipated that this will provide useful information for a first pass at rules performance problem debugging. This should not be used to drive user logic.

This currently returns a Clojure array map in order to conveniently have the rules with the most interactions printed first in the string representation of the map.

tracing-listener

(tracing-listener)

Creates a persistent tracing event listener

with-tracing

(with-tracing session)

Returns a new session identical to the given one, but with tracing enabled. The given session is returned unmodified if tracing is already enabled.

without-tracing

(without-tracing session)

Returns a new session identical to the given one, but with tracing disabled The given session is returned unmodified if tracing is already disabled.