provider_enabled

Macro provider_enabled 

Source
provider_enabled!() { /* proc-macro */ }
Expand description

Returns true if a write_event! macro using the specified PROVIDER_SYMBOL, level, and keyword would be enabled, false if it would be disabled.

Usage: let enabled = provider_enabled!(PROVIDER_SYMBOL, level, keyword);

The PROVIDER_SYMBOL parameter should be the original symbol name created by define_provider!, not a reference or alias.

The level and keyword parameters must be compile-time constant expressions.

Note that write_event! already checks whether the tracepoint is enabled – it skips evaluating the field value expressions and skips sending the event if the tracepoint is not enabled. You only need to make your own call to provider_enabled! if you want to control something other than write_event!.

Implementation details: This macro registers an inert tracepoint with the specified provider, level, and keyword, and returns true if that tracepoint is enabled.