NVTX++  3.0
C++ convenience wrappers for NVTX.
Public Types | Public Member Functions | List of all members
nvtx3::event_attributes Class Reference

Describes the attributes of a NVTX event. More...

#include <nvtx3.hpp>

Public Types

using value_type = nvtxEventAttributes_t
 

Public Member Functions

constexpr event_attributes () noexcept
 Default constructor creates an event_attributes with no category, color, payload, nor message.
 
template<typename... Args>
NVTX3_RELAXED_CONSTEXPR event_attributes (category const &c, Args const &...args) noexcept
 Variadic constructor where the first argument is a category. More...
 
template<typename... Args>
NVTX3_RELAXED_CONSTEXPR event_attributes (color const &c, Args const &...args) noexcept
 Variadic constructor where the first argument is a color. More...
 
template<typename... Args>
NVTX3_RELAXED_CONSTEXPR event_attributes (payload const &p, Args const &...args) noexcept
 Variadic constructor where the first argument is a payload. More...
 
template<typename... Args>
NVTX3_RELAXED_CONSTEXPR event_attributes (message const &m, Args const &...args) noexcept
 Variadic constructor where the first argument is a message. More...
 
 event_attributes (event_attributes const &)=default
 
event_attributesoperator= (event_attributes const &)=default
 
 event_attributes (event_attributes &&)=default
 
event_attributesoperator= (event_attributes &&)=default
 
constexpr value_type const * get () const noexcept
 Get raw pointer to underlying NVTX attributes object.
 

Detailed Description

Describes the attributes of a NVTX event.

NVTX events can be customized via four "attributes":

These component attributes are specified via an event_attributes object. See nvtx3::color, nvtx3::message, nvtx3::payload, and nvtx3::category for how these individual attributes are constructed.

While it is possible to specify all four attributes, it is common to want to only specify a subset of attributes and use default values for the others. For convenience, event_attributes can be constructed from any number of attribute components in any order.

Example:

event_attributes attr{}; // No arguments, use defaults for all attributes
event_attributes attr{"message"}; // Custom message, rest defaulted
// Custom color & message
event_attributes attr{"message", nvtx3::rgb{127, 255, 0}};
event_attributes attr{nvtx3::rgb{127, 255, 0}, "message"};
// Custom color, message, payload, category
event_attributes attr{nvtx3::rgb{127, 255, 0},
"message",
// Custom color, message, payload, category, can use any order of arguments
"message",
nvtx3::rgb{127, 255, 0}};
// Multiple arguments of the same type are allowed, but only the first is
// used. All others are ignored
event_attributes attr{ nvtx3::payload{42}, nvtx3::payload{7} }; // payload
is 42
// Range `r` will be customized according the attributes in `attr`
// For convenience, the arguments that can be passed to the
// constructor may be passed to the `domain_thread_range` contructor where
// they will be forwarded to the `EventAttribute`s constructor

Constructor & Destructor Documentation

template<typename... Args>
NVTX3_RELAXED_CONSTEXPR nvtx3::event_attributes::event_attributes ( category const &  c,
Args const &...  args 
)
inlineexplicitnoexcept

Variadic constructor where the first argument is a category.

Sets the value of the EventAttributes category based on c and forwards the remaining variadic parameter pack to the next constructor.

template<typename... Args>
NVTX3_RELAXED_CONSTEXPR nvtx3::event_attributes::event_attributes ( color const &  c,
Args const &...  args 
)
inlineexplicitnoexcept

Variadic constructor where the first argument is a color.

Sets the value of the EventAttributes color based on c and forwards the remaining variadic parameter pack to the next constructor.

template<typename... Args>
NVTX3_RELAXED_CONSTEXPR nvtx3::event_attributes::event_attributes ( payload const &  p,
Args const &...  args 
)
inlineexplicitnoexcept

Variadic constructor where the first argument is a payload.

Sets the value of the EventAttributes payload based on p and forwards the remaining variadic parameter pack to the next constructor.

template<typename... Args>
NVTX3_RELAXED_CONSTEXPR nvtx3::event_attributes::event_attributes ( message const &  m,
Args const &...  args 
)
inlineexplicitnoexcept

Variadic constructor where the first argument is a message.

Sets the value of the EventAttributes message based on m and forwards the remaining variadic parameter pack to the next constructor.


The documentation for this class was generated from the following file: