CARB_PROFILE_DECLARE_CHANNEL

Defined in carb/profiler/Profile.h

CARB_PROFILE_DECLARE_CHANNEL(name_, defaultMask_, defaultEnabled_, symbol_)

Declares a channel that can be used with the profiler.

Channels can be used in place of a mask for macros such as CARB_PROFILE_ZONE. Channels allow enabling and disabling at runtime, or based on a settings configuration.

Channels must have static storage and module lifetime, therefore this macro should be used at file-level, class-level or namespace-level scope only. Any other use is undefined behavior.

Channels must be declared in exactly one compilation unit for a given module. References to the channel can be accomplished with CARB_PROFILE_EXTERN_CHANNEL for other compilation units that desire to reference the channel.

Channel settings are located under /profiler/channels/<name> and may have the following values:

  • enabled - (bool) whether this channel is enabled (reports to the profiler) or not

  • mask - (uint64_t) the mask used with the profiler

Parameters
  • name_ – A string name for this channel. This is used to look up settings keys for this channel.

  • defaultMask_ – The profiler works with the concept of masks. The profiler must have the capture mask enabled for this channel to report to the profiler. A typical value for this could be carb::profiler::kCaptureMaskDefault.

  • defaultEnabled_ – Whether this channel is enabled to report to the profiler by default.

  • symbol_ – The symbol name that code would refer to this channel by.