zeek.bif: Implement table_pattern_matcher_stats() bif for introspection

Provide a script accessible way to introspect the DFA stats that can be
leveraged to gather runtime statistics of the underlying DFA. This
re-uses the existing MatcherStats used by ``get_matcher_stats()``.
This commit is contained in:
Arne Welzel 2023-11-08 20:30:04 +01:00
parent 3f240e0f0a
commit e39f280e3d
6 changed files with 116 additions and 0 deletions

View file

@ -53,6 +53,8 @@ class CompositeHash;
class HashKey;
class TablePatternMatcher;
struct DFA_State_Cache_Stats;
class ValTrace;
class ZBody;
class CPPRuntime;
@ -869,6 +871,10 @@ public:
// Causes an internal error if called for any other kind of table.
VectorValPtr LookupPattern(const StringValPtr& s);
// For a table[pattern], fill stats with information about
// the DFA's state for introspection.
void GetPatternMatcherStats(detail::DFA_State_Cache_Stats* stats) const;
// Sets the timestamp for the given index to network time.
// Returns false if index does not exist.
bool UpdateTimestamp(Val* index);