Skip to main content

chronon::observe::CategoryPatternMatcher

More...

#include <CategoryPatternMatcher.hpp>

Public Functions

Name
CategoryMaskresolvePatterns(const std::vector< std::string > & patterns)
CategoryMaskresolvePattern(std::string_view pattern)
boolmatches(std::string_view pattern, std::string_view name)
boolhasMatchingCategories(std::string_view pattern)
std::vector< const CategoryRegistry::CategoryEntry * >getMatchingCategories(std::string_view pattern)

Detailed Description

class chronon::observe::CategoryPatternMatcher;

CategoryPatternMatcher - Matches category names against glob patterns.

Supports the following pattern types:

  • "*" : Match all categories
  • "prefix*" or "prefix_*" : Match categories starting with prefix
  • "*suffix" : Match categories ending with suffix
  • "exact" : Match exactly this name

Examples: matches("", "icache_hit") -> true matches("icache_", "icache_hit") -> true matches("icache_", "dcache_hit") -> false matches("_hit", "icache_hit") -> true matches("branch_pred", "branch_pred") -> true

Public Functions Documentation

function resolvePatterns

static inline CategoryMask resolvePatterns(
const std::vector< std::string > & patterns
)

Parameters:

  • patterns Vector of glob patterns

Return: Combined CategoryMask of all matching categories

Resolve multiple patterns to a combined CategoryMask.

function resolvePattern

static inline CategoryMask resolvePattern(
std::string_view pattern
)

Parameters:

  • pattern The glob pattern

Return: Combined CategoryMask of all matching categories (0 if none match)

Resolve a pattern to a combined CategoryMask using the CategoryRegistry.

function matches

static inline bool matches(
std::string_view pattern,
std::string_view name
)

Parameters:

  • pattern The glob pattern (e.g., "icache_", "", "exact")
  • name The category name to test

Return: true if name matches pattern

Check if a category name matches a pattern.

function hasMatchingCategories

static inline bool hasMatchingCategories(
std::string_view pattern
)

Parameters:

  • pattern The glob pattern

Return: true if at least one category matches

Check if a pattern would match any registered category.

function getMatchingCategories

static inline std::vector< const CategoryRegistry::CategoryEntry * > getMatchingCategories(
std::string_view pattern
)

Parameters:

  • pattern The glob pattern

Return: Vector of matching CategoryEntry references

Get all matching category entries for a pattern.


Updated on 2026-05-26 at 05:42:33 +0000