NVTX++
3.0
C++ convenience wrappers for NVTX.
|
A category
with an associated name string.
More...
#include <nvtx3.hpp>
Public Member Functions | |
named_category (id_type id, char const *name) noexcept | |
Construct a category with the specified id and name . More... | |
named_category (id_type id, wchar_t const *name) noexcept | |
Construct a category with the specified id and name . More... | |
![]() | |
constexpr | category (id_type id) noexcept |
Construct a category with the specified id . More... | |
constexpr id_type | get_id () const noexcept |
Returns the id of the category. | |
category (category const &)=default | |
category & | operator= (category const &)=default |
category (category &&)=default | |
category & | operator= (category &&)=default |
Static Public Member Functions | |
template<typename C > | |
static named_category< D > const & | get () noexcept |
Returns a global instance of a named_category as a function-local static. More... | |
Additional Inherited Members | |
![]() | |
using | id_type = uint32_t |
Type used for category s integer id. | |
A category
with an associated name string.
Associates a name
string with a category id
to help differentiate among categories.
For any given category id Id
, a named_category(Id, "name")
should only be constructed once and reused throughout an application. This can be done by either explicitly creating static named_category
objects, or using the named_category::get
construct on first use helper (recommended).
Creating two or more named_category
objects with the same value for id
in the same domain results in undefined behavior.
Similarly, behavior is undefined when a named_category
and category
share the same value of id
.
Example:
named_category
's association of a name to a category id is local to the domain specified by the type D
. An id may have a different name in another domain.
D | Type containing name member used to identify the domain to which the named_category belongs. Else, domain::global to indicate that the global NVTX domain should be used. |
|
inlinenoexcept |
Construct a category
with the specified id
and name
.
The name name
will be registered with id
.
Every unique value of id
should only be named once.
[in] | id | The category id to name |
[in] | name | The name to associated with id |
|
inlinenoexcept |
Construct a category
with the specified id
and name
.
The name name
will be registered with id
.
Every unique value of id
should only be named once.
[in] | id | The category id to name |
[in] | name | The name to associated with id |
|
inlinestaticnoexcept |
Returns a global instance of a named_category
as a function-local static.
Creates a named_category
with name and id specified by the contents of a type C
. C::name
determines the name and C::id
determines the category id.
This function is useful for constructing a named category
exactly once and reusing the same instance throughout an application.
Example:
Uses the "construct on first use" idiom to safely ensure the category
object is initialized exactly once. See https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use
C | Type containing a member C::name that resolves to either a char const* or wchar_t const* and C::id . |