carb::profiler::Channel

Defined in carb/profiler/ProfilerUtils.h

class Channel

Profiler channel which can be configured via carb::settings::ISettings.

Warning

Do not use this class directly. Instead, use CARB_PROFILE_DECLARE_CHANNEL().

Public Functions

inline Channel(uint64_t mask, bool enabled, const char *name)

Constructor.

Warning

Do not call this directly. Instead use CARB_PROFILE_DECLARE_CHANNEL().

Warning

Instances of this class must have static storage and module-lifetime, therefore they may only exist at file-level scope, class-level (static) scope, or namespace-level scope only. Anything else is undefined behavior.

Parameters
  • mask – The default profiler mask for this channel.

  • enabled – Whether this channel is enabled by default.

  • name – A literal string that is used to look up settings keys.

inline const char *getName() const noexcept

Returns the name of this channel.

Returns

the channel name.

inline uint64_t getMask() const noexcept

Returns the current mask for this channel.

Returns

the current mask.

inline void setMask(uint64_t mask) noexcept

Sets the mask value for *this.

Parameters

mask – The new profiler mask value.

inline bool isEnabled() const noexcept

Returns whether this channel is enabled.

Returns

true if this channel is enabled; false otherwise.

inline void setEnabled(bool enabled) noexcept

Sets *this to enabled or disabled.

Parameters

enabled – Whether to enable (true) or disable (false) the channel.

Public Static Functions

static inline void onProfilerRegistered()

Called by profiler::registerProfilerForClient() to initialize all channels.

If ISettings is available, it is queried for this module’s channel’s settings, and a subscription is installed to be notified when settings change. If ISettings is not available, a load hook is installed with the framework in order to be notified if and when ISettings becomes available.

static inline void onProfilerUnregistered()

Called by profiler::deregisterProfilerForClient() to uninitialize all channels.

Any load hooks and subscriptions installed with ISettings are removed.