21#if defined(NVTX_AS_SYSTEM_HEADER)
23#pragma clang system_header
24#elif defined(__GNUC__) || defined(__NVCOMPILER)
25#pragma GCC system_header
26#elif defined(_MSC_VER)
32#define NVTX3_CPP_VERSION_MAJOR 1
33#define NVTX3_CPP_VERSION_MINOR 1
55#if !defined(NVTX3_CPP_REQUIRE_EXPLICIT_VERSION)
59 #define NVTX3_INLINE_THIS_VERSION
61 #if !defined(NVTX3_CPP_INLINED_VERSION_MAJOR)
76 #define NVTX3_CPP_INLINED_VERSION_MAJOR 1
88 #define NVTX3_CPP_INLINED_VERSION_MINOR 1
89 #elif NVTX3_CPP_INLINED_VERSION_MAJOR != NVTX3_CPP_VERSION_MAJOR
94 "Two different major versions of the NVTX C++ Wrappers are being included in a single .cpp file, with unversioned symbols enabled in both. Only one major version can enable unversioned symbols in a .cpp file. To disable unversioned symbols, #define NVTX3_CPP_REQUIRE_EXPLICIT_VERSION before #including nvtx3.hpp, and use the explicit-version symbols instead -- this is the preferred way to use nvtx3.hpp from a header file."
95 #elif (NVTX3_CPP_INLINED_VERSION_MAJOR == NVTX3_CPP_VERSION_MAJOR) && \
96 (NVTX3_CPP_INLINED_VERSION_MINOR < NVTX3_CPP_VERSION_MINOR)
101 #undef NVTX3_CPP_INLINED_VERSION_MINOR
102 #define NVTX3_CPP_INLINED_VERSION_MINOR 1
638#if !defined(NVTX3_USE_CHECKED_OVERLOADS_FOR_GET)
639#if defined(_MSC_VER) && _MSC_VER < 1914 \
640 || defined(__GNUC__) && __GNUC__ == 8 && __GNUC_MINOR__ < 4
641#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET 0
643#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET 1
645#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET_DEFINED_HERE
650#define NVTX3_CONCAT(A, B) A##B
651#define NVTX3_NAMESPACE_FOR(VERSION) NVTX3_CONCAT(v, VERSION)
652#define NVTX3_VERSION_NAMESPACE NVTX3_NAMESPACE_FOR(NVTX3_CPP_VERSION_MAJOR)
654#define NVTX3_MINOR_NAMESPACE_FOR(VERSION) NVTX3_CONCAT(mv, VERSION)
655#define NVTX3_MINOR_VERSION_NAMESPACE NVTX3_MINOR_NAMESPACE_FOR(NVTX3_CPP_VERSION_MINOR)
660#if defined(NVTX3_INLINE_THIS_VERSION)
661#define NVTX3_INLINE_IF_REQUESTED inline
663#define NVTX3_INLINE_IF_REQUESTED
676#if __cpp_constexpr >= 201304L
677#define NVTX3_CONSTEXPR_IF_CPP14 constexpr
679#define NVTX3_CONSTEXPR_IF_CPP14
684#if __cplusplus >= 202002L
685#define NVTX3_CONSTEXPR_IF_CPP20 constexpr
687#define NVTX3_CONSTEXPR_IF_CPP20
691#if !defined(__has_cpp_attribute)
692#define __has_cpp_attribute(x) 0
694#if __has_cpp_attribute(maybe_unused)
695#define NVTX3_MAYBE_UNUSED [[maybe_unused]]
697#define NVTX3_MAYBE_UNUSED
699#if __has_cpp_attribute(nodiscard)
700#define NVTX3_NO_DISCARD [[nodiscard]]
702#define NVTX3_NO_DISCARD
710#if !defined(NVTX3_STATIC_ASSERT)
711#define NVTX3_STATIC_ASSERT(condition, message) static_assert(condition, message)
712#define NVTX3_STATIC_ASSERT_DEFINED_HERE
717#ifndef NVTX3_CPP_DEFINITIONS_V1_0
718#define NVTX3_CPP_DEFINITIONS_V1_0
720#include "nvToolsExt.h"
721#include "nvToolsExtPayload.h"
722#include "nvToolsExtPayloadHelper.h"
726#include <type_traits>
733NVTX3_INLINE_IF_REQUESTED
namespace NVTX3_VERSION_NAMESPACE
735inline namespace NVTX3_MINOR_VERSION_NAMESPACE
740template <
typename Unused>
741struct always_false : std::false_type {};
743template <
typename T,
typename =
void>
744struct has_name : std::false_type {};
746struct has_name<T, decltype((void)T::name, void())> : std::true_type {};
748template <
typename T,
typename =
void>
749struct has_id : std::false_type {};
751struct has_id<T, decltype((void)T::id, void())> : std::true_type {};
753template <
typename T,
typename =
void>
754struct has_message : std::false_type {};
756struct has_message<T, decltype((void)T::message, void())> : std::true_type {};
758template <
typename T,
typename =
void>
759struct is_c_string : std::false_type {};
761struct is_c_string<T, typename std::enable_if<
762 std::is_convertible<T, char const* >::value ||
763 std::is_convertible<T, wchar_t const*>::value
764>::type> : std::true_type {};
767using is_uint32 = std::is_same<typename std::decay<T>::type, uint32_t>;
769template <
typename... Args>
770static inline void silence_unused(Args
const&...)
noexcept {}
774template <
typename T,
typename TD>
775struct has_data_member
778 template <
typename U>
779 static auto test_data(
int) ->
decltype(std::declval<const U>().data());
781 static auto test_data(...) -> void;
782 using return_type =
decltype(test_data<T>(0));
785 static constexpr bool value =
786 std::is_same<return_type, TD*>::value || std::is_same<return_type, TD const*>::value;
791struct has_size_member
794 template <
typename U>
795 static auto test_size(
int) ->
decltype(std::declval<const U>().size());
797 static auto test_size(...) -> void;
798 using return_type =
decltype(test_size<T>(0));
801 static constexpr bool value = !std::is_same<return_type, void>::value &&
802 std::is_convertible<return_type, size_t>::value;
815template <
typename W,
typename U,
typename =
void>
816struct is_safe_wrapper_of : std::false_type
820template <
typename W,
typename U>
821struct is_safe_wrapper_of<
824 typename std::enable_if<
825 std::is_standard_layout<W>::value && std::is_standard_layout<U>::value &&
826 std::is_trivially_copyable<W>::value && std::is_trivially_copyable<U>::value &&
827 sizeof(W) == sizeof(U)>::type> : std::true_type
906#if NVTX3_USE_CHECKED_OVERLOADS_FOR_GET
951 template <
typename D =
global,
952 typename std::enable_if<
953 detail::is_c_string<
decltype(D::name)>::value
957 static domain const d(D::name);
966 template <
typename D = global,
967 typename std::enable_if<
968 !detail::is_c_string<
decltype(D::name)>::value
972 NVTX3_STATIC_ASSERT(detail::always_false<D>::value,
973 "Type used to identify an NVTX domain must contain a static constexpr member "
974 "called 'name' of type const char* or const wchar_t* -- 'name' member is not "
975 "convertible to either of those types");
976 static domain const unused;
984 template <
typename D = global,
985 typename std::enable_if<
986 !detail::has_name<D>::value
990 NVTX3_STATIC_ASSERT(detail::always_false<D>::value,
991 "Type used to identify an NVTX domain must contain a static constexpr member "
992 "called 'name' of type const char* or const wchar_t* -- 'name' member is missing");
993 static domain const unused;
997 template <
typename D = global>
998 NVTX3_NO_DISCARD
static domain const& get() noexcept
1000 static domain const d(D::name);
1011 operator nvtxDomainHandle_t() const noexcept {
return _domain; }
1022 explicit domain(
char const* name) noexcept : _domain{nvtxDomainCreateA(name)} {}
1032 explicit domain(
wchar_t const* name) noexcept : _domain{nvtxDomainCreateW(name)} {}
1042 explicit domain(std::string
const& name) noexcept : domain{name.c_str()} {}
1052 explicit domain(std::wstring
const& name) noexcept : domain{name.c_str()} {}
1062 constexpr domain() noexcept {}
1078 ~domain() =
default;
1081 nvtxDomainHandle_t
const _domain{};
1098NVTX3_NO_DISCARD
inline domain const& domain::get<domain::global>() noexcept
1127 : red{red_}, green{green_}, blue{blue_}
1159 :
rgb{red_, green_, blue_}, alpha{alpha_}
1206 :
color{from_bytes_msb_to_lsb(argb_.alpha, argb_.red, argb_.green, argb_.blue)}
1219 :
color{from_bytes_msb_to_lsb(0xFF, rgb_.red, rgb_.green, rgb_.blue)}
1233 constexpr nvtxColorType_t
get_type() const noexcept {
return _type; }
1248 constexpr static value_type from_bytes_msb_to_lsb(
1252 uint8_t byte0)
noexcept
1254 return uint32_t{byte3} << 24 | uint32_t{byte2} << 16 | uint32_t{byte1} << 8 | uint32_t{byte0};
1257 value_type _value{};
1258 nvtxColorType_t _type{NVTX_COLOR_ARGB};
1364template <
typename D = domain::global>
1367#if NVTX3_USE_CHECKED_OVERLOADS_FOR_GET
1402 template <
typename C,
1403 typename std::enable_if<
1404 detail::is_c_string<
decltype(C::name)>::value &&
1405 detail::is_uint32<
decltype(C::id)>::value
1419 template <
typename C,
1420 typename std::enable_if<
1421 !detail::is_c_string<
decltype(C::name)>::value ||
1422 !detail::is_uint32<
decltype(C::id)>::value
1426 NVTX3_STATIC_ASSERT(detail::is_c_string<
decltype(C::name)>::value,
1427 "Type used to name an NVTX category must contain a static constexpr member "
1428 "called 'name' of type const char* or const wchar_t* -- 'name' member is not "
1429 "convertible to either of those types");
1430 NVTX3_STATIC_ASSERT(detail::is_uint32<
decltype(C::id)>::value,
1431 "Type used to name an NVTX category must contain a static constexpr member "
1432 "called 'id' of type uint32_t -- 'id' member is the wrong type");
1441 template <
typename C,
1442 typename std::enable_if<
1443 !detail::has_name<C>::value ||
1444 !detail::has_id<C>::value
1448 NVTX3_STATIC_ASSERT(detail::has_name<C>::value,
1449 "Type used to name an NVTX category must contain a static constexpr member "
1450 "called 'name' of type const char* or const wchar_t* -- 'name' member is missing");
1451 NVTX3_STATIC_ASSERT(detail::has_id<C>::value,
1452 "Type used to name an NVTX category must contain a static constexpr member "
1453 "called 'id' of type uint32_t -- 'id' member is missing");
1458 template <
typename C>
1484 nvtxDomainNameCategoryA(domain::get<D>(), get_id(), name);
1504 nvtxDomainNameCategoryW(domain::get<D>(), get_id(), name);
1564template <
typename D = domain::global>
1567#if NVTX3_USE_CHECKED_OVERLOADS_FOR_GET
1601 template <
typename M,
1602 typename std::enable_if<
1603 detail::is_c_string<
decltype(M::message)>::value
1616 template <
typename M,
1617 typename std::enable_if<
1618 !detail::is_c_string<
decltype(M::message)>::value
1622 NVTX3_STATIC_ASSERT(detail::always_false<M>::value,
1623 "Type used to register an NVTX string must contain a static constexpr member "
1624 "called 'message' of type const char* or const wchar_t* -- 'message' member is "
1625 "not convertible to either of those types");
1634 template <
typename M,
1635 typename std::enable_if<
1636 !detail::has_message<M>::value
1640 NVTX3_STATIC_ASSERT(detail::always_false<M>::value,
1641 "Type used to register an NVTX string must contain a static constexpr member "
1642 "called 'message' of type const char* or const wchar_t* -- 'message' member "
1648 template <
typename M>
1668 : handle_{nvtxDomainRegisterStringA(domain::get<D>(), msg)}
1698 : handle_{nvtxDomainRegisterStringW(domain::get<D>(), msg)}
1724 NVTX3_STATIC_ASSERT(
1726 "Internal error! registered_string_in is potentially unsafe.");
1741 nvtxStringHandle_t handle_{};
1790 using value_type = nvtxMessageValue_t;
1797 NVTX3_CONSTEXPR_IF_CPP14
message(
char const* msg) noexcept : type_{NVTX_MESSAGE_TYPE_ASCII}
1817#ifndef NVTX3_ALLOW_RVALUE_CONSTRUCTORS
1826 NVTX3_CONSTEXPR_IF_CPP14
message(
wchar_t const* msg) noexcept : type_{NVTX_MESSAGE_TYPE_UNICODE}
1828 value_.unicode = msg;
1846#ifndef NVTX3_ALLOW_RVALUE_CONSTRUCTORS
1858 template <
typename D>
1860 : type_{NVTX_MESSAGE_TYPE_REGISTERED}
1862 value_.registered = msg.get_handle();
1872 nvtxMessageType_t
const& type,
1873 nvtxMessageValue_t
const& value) noexcept
1874 : type_{type}, value_(value)
1883 NVTX3_CONSTEXPR_IF_CPP14
message(nvtxStringHandle_t handle) noexcept
1884 : type_{NVTX_MESSAGE_TYPE_REGISTERED}
1886 value_.registered = handle;
1893 constexpr value_type
get_value() const noexcept {
return value_; }
1899 constexpr nvtxMessageType_t
get_type() const noexcept {
return type_; }
1902 nvtxMessageType_t type_{};
1903 nvtxMessageValue_t value_{};
1924 using value_type =
typename nvtxEventAttributes_v2::payload_t;
1931 NVTX3_CONSTEXPR_IF_CPP14
explicit payload(int64_t value) noexcept
1932 : type_{NVTX_PAYLOAD_TYPE_INT64}, value_{}
1934 value_.llValue = value;
1942 NVTX3_CONSTEXPR_IF_CPP14
explicit payload(int32_t value) noexcept
1943 : type_{NVTX_PAYLOAD_TYPE_INT32}, value_{}
1945 value_.iValue = value;
1953 NVTX3_CONSTEXPR_IF_CPP14
explicit payload(uint64_t value) noexcept
1954 : type_{NVTX_PAYLOAD_TYPE_UNSIGNED_INT64}, value_{}
1956 value_.ullValue = value;
1964 NVTX3_CONSTEXPR_IF_CPP14
explicit payload(uint32_t value) noexcept
1965 : type_{NVTX_PAYLOAD_TYPE_UNSIGNED_INT32}, value_{}
1967 value_.uiValue = value;
1976 NVTX3_CONSTEXPR_IF_CPP14
explicit payload(
float value) noexcept
1977 : type_{NVTX_PAYLOAD_TYPE_FLOAT}, value_{}
1979 value_.fValue = value;
1988 NVTX3_CONSTEXPR_IF_CPP14
explicit payload(
double value) noexcept
1989 : type_{NVTX_PAYLOAD_TYPE_DOUBLE}, value_{}
1991 value_.dValue = value;
2001 nvtxPayloadType_t
const& type,
2002 value_type
const& value) noexcept
2003 : type_{type}, value_(value)
2011 constexpr value_type
get_value() const noexcept {
return value_; }
2017 constexpr nvtxPayloadType_t
get_type() const noexcept {
return type_; }
2020 nvtxPayloadType_t type_;
2075 template <
typename T>
2078 NVTX3_STATIC_ASSERT(
2079 detail::always_false<T>::value,
2080 "payload_data schema deduction requires a template specialization. Use the macro "
2081 "NVTX3_DEFINE_SCHEMA_GET to generate this specialization.");
2095 uint64_t
const _schema_id;
2138 typename T =
typename std::remove_cv<typename std::remove_reference<R>::type>::type,
2139 typename =
typename std::enable_if<!std::is_same<T, nvtxPayloadData_t>::value>::type>
2141 : data_{
schema::get<T>().get_handle(), sizeof(T), &t}
2143#ifndef NVTX3_ALLOW_RVALUE_CONSTRUCTORS
2144 NVTX3_STATIC_ASSERT(
2145 std::is_lvalue_reference<R>::value,
2146 "payload_data requires an lvalue reference to the underlying data. Constructing "
2147 "from an rvalue is potentially unsafe and therefore forbidden.");
2149 NVTX3_STATIC_ASSERT(
2150 std::is_standard_layout<T>::value && std::is_trivially_copyable<T>::value,
2151 "structs used for NVTX3 payload schema must be standard layout and trivially copyable");
2166 template <
typename T>
2168 : data_{s.get_handle(), sizeof(T), &t}
2170 NVTX3_STATIC_ASSERT(
2171 std::is_standard_layout<T>::value && std::is_trivially_copyable<T>::value,
2172 "structs used for NVTX3 payload schema must be standard layout and trivially copyable");
2181 NVTX3_STATIC_ASSERT(
2182 (detail::is_safe_wrapper_of<payload_data, nvtxPayloadData_t>::value),
2183 "Internal error! payload_data is potentially unsafe.");
2184 return NVTX_POINTER_AS_PAYLOAD_ULLVALUE(&data_);
2188 nvtxPayloadData_t data_;
2251 using value_type = nvtxEventAttributes_t;
2260 sizeof(nvtxEventAttributes_t),
2264 NVTX_PAYLOAD_UNKNOWN,
2267 NVTX_MESSAGE_UNKNOWN,
2280 template <
typename... Args>
2284 attributes_.category = c.get_id();
2294 template <
typename... Args>
2298 attributes_.color = c.get_value();
2299 attributes_.colorType = c.get_type();
2309 template <
typename... Args>
2313 attributes_.payload = p.get_value();
2314 attributes_.payloadType = p.get_type();
2324 template <
typename... Args>
2328 attributes_.payloadType = NVTX_PAYLOAD_TYPE_EXT;
2329 attributes_.reserved0 = 1;
2330 attributes_.payload.ullValue = pd.as_ull_value();
2340#ifndef NVTX3_ALLOW_RVALUE_CONSTRUCTORS
2341 template <
typename... Args>
2357 typename =
typename std::enable_if<
2358 detail::has_data_member<T, payload_data>::value && detail::has_size_member<T>::value>::type>
2362 NVTX3_STATIC_ASSERT(
2363 std::is_lvalue_reference<T>::value,
2364 "event_attributes requires an lvalue reference to the underlying data. "
2365 "Constructing from an rvalue is potentially unsafe and therefore forbidden.");
2366 attributes_.payloadType = NVTX_PAYLOAD_TYPE_EXT;
2367 attributes_.reserved0 =
static_cast<int32_t
>(pdc.size());
2368 attributes_.payload.ullValue = pdc.data()->as_ull_value();
2378 template <
typename... Args>
2382 attributes_.message = m.get_value();
2383 attributes_.messageType = m.get_type();
2396 constexpr value_type
const*
get() const noexcept {
return &attributes_; }
2399 value_type attributes_{};
2449template <
class D = domain::global>
2469 nvtxDomainRangePushEx(domain::get<D>(), attr.get());
2495 template <
typename... Args>
2514 void*
operator new(std::size_t) =
delete;
2527 nvtxDomainRangePop(domain::get<D>());
2541template <
typename D = domain::global>
2542class NVTX3_MAYBE_UNUSED optional_scoped_range_in
2545 optional_scoped_range_in() =
default;
2554 if (initialized) {
return; }
2556 nvtxDomainRangePushEx(domain::get<D>(), attr.
get());
2563 ~optional_scoped_range_in()
noexcept
2566 if (initialized) { nvtxDomainRangePop(domain::get<D>()); }
2570 void*
operator new(std::size_t) =
delete;
2571 optional_scoped_range_in(optional_scoped_range_in
const&) =
delete;
2572 optional_scoped_range_in& operator=(optional_scoped_range_in
const&) =
delete;
2573 optional_scoped_range_in(optional_scoped_range_in&&) =
delete;
2574 optional_scoped_range_in& operator=(optional_scoped_range_in&&) =
delete;
2578 bool initialized =
false;
2622 constexpr explicit operator
bool() const noexcept {
return get_value() != null_range_id; }
2641 static constexpr value_type null_range_id = nvtxRangeId_t{0};
2643 value_type _range_id{null_range_id};
2654 return lhs.get_value() == rhs.get_value();
2694template <
typename D = domain::global>
2698 return range_handle{nvtxDomainRangeStartEx(domain::get<D>(), attr.get())};
2735template <
typename D = domain::global,
typename... Args>
2741 detail::silence_unused(args...);
2775 return start_range_in<domain::global>(attr);
2809template <
typename... Args>
2813 return start_range_in<domain::global>(args...);
2815 detail::silence_unused(args...);
2835template <
typename D = domain::global>
2839 nvtxDomainRangeEnd(domain::get<D>(), r.get_value());
2861 end_range_in<domain::global>(r);
2888template <
typename D = domain::global>
2905 : handle_{start_range_in<D>(attr)}
2928 template <
typename... Args>
2973 struct end_range_handle {
2975 void operator()(
range_handle h)
const noexcept { end_range_in<D>(h); }
2979 std::unique_ptr<range_handle, end_range_handle> handle_;
3011template <
typename D = domain::global>
3015 nvtxDomainMarkEx(domain::get<D>(), attr.get());
3048template <
typename D = domain::global,
typename... Args>
3054 detail::silence_unused(args...);
3081 mark_in<domain::global>(attr);
3111template <
typename... Args>
3112inline void mark(Args
const&... args)
noexcept
3115 mark_in<domain::global>(args...);
3117 detail::silence_unused(args...);
3154#define NVTX3_V1_FUNC_RANGE_IN(D) \
3155 static ::nvtx3::v1::registered_string_in<D> const nvtx3_func_name__{__func__}; \
3156 static ::nvtx3::v1::event_attributes const nvtx3_func_attr__{nvtx3_func_name__}; \
3157 ::nvtx3::v1::scoped_range_in<D> const nvtx3_range__{nvtx3_func_attr__}
3175#define NVTX3_V1_FUNC_RANGE_IF_IN(D, C) \
3176 ::nvtx3::v1::detail::optional_scoped_range_in<D> optional_nvtx3_range__; \
3178 static ::nvtx3::v1::registered_string_in<D> const nvtx3_func_name__{__func__}; \
3179 static ::nvtx3::v1::event_attributes const nvtx3_func_attr__{nvtx3_func_name__}; \
3180 optional_nvtx3_range__.begin(nvtx3_func_attr__); \
3183#define NVTX3_V1_FUNC_RANGE_IN(D) (void)0
3184#define NVTX3_V1_FUNC_RANGE_IF_IN(D, C) (void)(C)
3209#define NVTX3_V1_FUNC_RANGE() NVTX3_V1_FUNC_RANGE_IN(::nvtx3::v1::domain::global)
3222#define NVTX3_V1_FUNC_RANGE_IF(C) NVTX3_V1_FUNC_RANGE_IF_IN(::nvtx3::v1::domain::global, C)
3225#if __has_cpp_attribute(nodiscard)
3226#define NVTX3_V1_NO_DISCARD [[nodiscard]]
3228#define NVTX3_V1_NO_DISCARD
3262#define NVTX3_V1_DEFINE_SCHEMA_GET(dom, struct_id, schema_name, entries) \
3264 NVTX3_V1_NO_DISCARD inline nvtx3::v1::schema const& nvtx3::v1::schema::get<struct_id>() noexcept \
3267 std::is_standard_layout<struct_id>::value, \
3268 "structs used for NVTX3 payload schema must be standard layout"); \
3270 std::is_trivially_copyable<struct_id>::value, \
3271 "structs used for NVTX3 payload schema must be trivially copyable"); \
3272 using nvtx_struct_id = struct_id; \
3273 _NVTX_DEFINE_SCHEMA_FOR_STRUCT(nvtx_struct_id, schema_name, static constexpr, entries) \
3274 static const schema s{ \
3275 nvtxPayloadSchemaRegister(nvtx3::v1::domain::get<dom>(), &nvtx_struct_id##Attr)}; \
3281#if defined(NVTX3_INLINE_THIS_VERSION)
3283#define NVTX3_FUNC_RANGE NVTX3_V1_FUNC_RANGE
3284#define NVTX3_FUNC_RANGE_IF NVTX3_V1_FUNC_RANGE_IF
3285#define NVTX3_FUNC_RANGE_IN NVTX3_V1_FUNC_RANGE_IN
3286#define NVTX3_FUNC_RANGE_IF_IN NVTX3_V1_FUNC_RANGE_IF_IN
3287#define NVTX3_DEFINE_SCHEMA_GET NVTX3_V1_DEFINE_SCHEMA_GET
3324#undef NVTX3_CPP_VERSION_MAJOR
3325#undef NVTX3_CPP_VERSION_MINOR
3327#undef NVTX3_NAMESPACE_FOR
3328#undef NVTX3_VERSION_NAMESPACE
3329#undef NVTX3_MINOR_NAMESPACE_FOR
3330#undef NVTX3_MINOR_VERSION_NAMESPACE
3331#undef NVTX3_INLINE_IF_REQUESTED
3332#undef NVTX3_CONSTEXPR_IF_CPP14
3333#undef NVTX3_MAYBE_UNUSED
3334#undef NVTX3_NO_DISCARD
3336#if defined(NVTX3_INLINE_THIS_VERSION)
3337#undef NVTX3_INLINE_THIS_VERSION
3340#if defined(NVTX3_USE_CHECKED_OVERLOADS_FOR_GET_DEFINED_HERE)
3341#undef NVTX3_USE_CHECKED_OVERLOADS_FOR_GET_DEFINED_HERE
3342#undef NVTX3_USE_CHECKED_OVERLOADS_FOR_GET
3345#if defined(NVTX3_STATIC_ASSERT_DEFINED_HERE)
3346#undef NVTX3_STATIC_ASSERT_DEFINED_HERE
3347#undef NVTX3_STATIC_ASSERT
Object for intra-domain grouping of NVTX events.
constexpr category(id_type id) noexcept
Construct a category with the specified id.
constexpr id_type get_id() const noexcept
Returns the id of the category.
uint32_t id_type
Type used for categorys integer id.
Represents a custom color that can be associated with an NVTX event via its event_attributes.
uint32_t value_type
Type used for the color's value.
constexpr nvtxColorType_t get_type() const noexcept
Return the NVTX color type of the color.
constexpr color(argb argb_) noexcept
Construct a color using the alpha, red, green, blue components in argb.
constexpr color(rgb rgb_) noexcept
Construct a color using the red, green, blue components in rgb.
constexpr color(value_type hex_code) noexcept
Constructs a color using the value provided by hex_code.
constexpr value_type get_value() const noexcept
Returns the colors argb hex code.
domains allow for grouping NVTX events into a single scope to differentiate them from events in other...
static domain const & get() noexcept
Returns reference to an instance of a function local static domain object.
Describes the attributes of a NVTX event.
constexpr event_attributes() noexcept
Default constructor creates an event_attributes with no category, color, payload, nor message.
constexpr value_type const * get() const noexcept
Get raw pointer to underlying NVTX attributes object.
event_attributes(payload_data &&pd, Args const &... args)=delete
Deleted constructor for payload_data rvalue references.
event_attributes(message const &m, Args const &... args) noexcept
Variadic constructor where the first argument is a message.
event_attributes(T &&pdc, Args const &... args) noexcept
Variadic constructor template for containers of payload_data.
event_attributes(payload const &p, Args const &... args) noexcept
Variadic constructor where the first argument is a payload.
event_attributes(color const &c, Args const &... args) noexcept
Variadic constructor where the first argument is a color.
event_attributes(category const &c, Args const &... args) noexcept
Variadic constructor where the first argument is a category.
event_attributes(payload_data const &pd, Args const &... args) noexcept
Variadic constructor where the first argument is a single payload_data.
Allows associating a message string with an NVTX event via its EventAttributes.
message(nvtxStringHandle_t handle) noexcept
Construct a message from NVTX C API registered string handle.
constexpr nvtxMessageType_t get_type() const noexcept
Return the type information about the value the union holds.
message(std::string const &msg) noexcept
Construct a message whose contents are specified by msg.
message(std::wstring const &msg) noexcept
Construct a message whose contents are specified by msg.
message(registered_string_in< D > const &msg) noexcept
Construct a message from a registered_string_in.
constexpr value_type get_value() const noexcept
Return the union holding the value of the message.
message(wchar_t const *msg) noexcept
Construct a message whose contents are specified by msg.
message(std::string &&)=delete
Disallow construction for std::string r-value.
message(char const *msg) noexcept
Construct a message whose contents are specified by msg.
constexpr message(nvtxMessageType_t const &type, nvtxMessageValue_t const &value) noexcept
Construct a message from NVTX C API type and value.
message(std::wstring &&)=delete
Disallow construction for std::wstring r-value.
A category with an associated name string.
named_category_in(id_type id, wchar_t const *name) noexcept
Construct a named_category_in with the specified id and name.
static named_category_in const & get() noexcept
Returns a global instance of a named_category_in as a function-local static.
named_category_in(id_type id, char const *name) noexcept
Construct a named_category_in with the specified id and name.
Wrapper around the NVTX C API nvtxPayloadData_t struct.
payload_data(T const &t, schema s)
Constructs payload_data for a payload instance with a given schema.
payload_data(nvtxPayloadData_t const &pd)
Constructs payload_data from an existing NVTX C API struct.
uint64_t as_ull_value() const noexcept
payload_data(R &&t)
Constructs payload_data for a specific payload struct instance.
A numerical value that can be associated with an NVTX event via its event_attributes.
payload(uint32_t value) noexcept
Construct a payload from an unsigned, 4 byte integer.
payload(double value) noexcept
Construct a payload from a double-precision floating point value.
payload(uint64_t value) noexcept
Construct a payload from an unsigned, 8 byte integer.
payload(int64_t value) noexcept
Construct a payload from a signed, 8 byte integer.
constexpr payload(nvtxPayloadType_t const &type, value_type const &value) noexcept
Construct a payload from NVTX C API type and value.
constexpr value_type get_value() const noexcept
Return the union holding the value of the payload.
constexpr nvtxPayloadType_t get_type() const noexcept
Return the information about the type the union holds.
payload(float value) noexcept
Construct a payload from a single-precision floating point value.
payload(int32_t value) noexcept
Construct a payload from a signed, 4 byte integer.
A message registered with NVTX.
static registered_string_in const & get() noexcept
Returns a global instance of a registered_string_in as a function local static.
nvtxStringHandle_t get_handle() const noexcept
Returns the registered string's handle.
registered_string_in(std::wstring const &msg) noexcept
Constructs a registered_string_in from the specified msg string.
registered_string_in(char const *msg) noexcept
Constructs a registered_string_in from the specified msg string.
registered_string_in(std::string const &msg) noexcept
Constructs a registered_string_in from the specified msg string.
registered_string_in(wchar_t const *msg) noexcept
Constructs a registered_string_in from the specified msg string.
Represents the registered schema for a payload struct.
static schema const & get() noexcept
Gets the schema instance for a specific payload struct type.
uint64_t get_handle() const noexcept
Return the underlying C handle of the schema.
schema(uint64_t id)
Constructs a schema object directly from a schema ID.
A RAII object for creating a NVTX range local to a thread within a domain.
scoped_range_in(Args const &... args) noexcept
Constructs a scoped_range_in from the constructor arguments of an event_attributes.
~scoped_range_in() noexcept
Destroy the scoped_range_in, ending the NVTX range event.
scoped_range_in(event_attributes const &attr) noexcept
Construct a scoped_range_in with the specified event_attributes
scoped_range_in() noexcept
Default constructor creates a scoped_range_in with no message, color, payload, nor category.
A RAII object for creating a NVTX range within a domain that can be created and destroyed on differen...
unique_range_in(event_attributes const &attr) noexcept
Construct a new unique_range_in object with the specified event attributes.
~unique_range_in() noexcept=default
Destroy the unique_range_in ending the range.
unique_range_in(Args const &... args) noexcept
Constructs a unique_range_in from the constructor arguments of an event_attributes.
constexpr unique_range_in() noexcept
Default constructor creates a unique_range_in with no message, color, payload, nor category.
void mark_in(event_attributes const &attr) noexcept
Annotates an instantaneous point in time with a "marker", using the attributes specified by attr.
constexpr bool operator!=(range_handle lhs, range_handle rhs) noexcept
Compares two range_handles for inequality.
constexpr bool operator==(range_handle lhs, range_handle rhs) noexcept
Compares two range_handles for equality.
void mark(event_attributes const &attr) noexcept
Annotates an instantaneous point in time with a "marker", using the attributes specified by attr,...
range_handle start_range_in(event_attributes const &attr) noexcept
Manually begin an NVTX range.
void end_range(range_handle r) noexcept
Manually end the range associated with the handle r in the global domain.
range_handle start_range(event_attributes const &attr) noexcept
Manually begin an NVTX range in the global domain.
void end_range_in(range_handle r) noexcept
Manually end the range associated with the handle r in domain D.
Indicates the value of the alpha, red, green, and blue color channels for an ARGB color to use as an ...
constexpr argb(component_type alpha_, component_type red_, component_type green_, component_type blue_) noexcept
Construct an argb with alpha, red, green, and blue channels specified by alpha_, red_,...
Tag type for the "global" NVTX domain.
Handle used for correlating explicit range start and end events.
nvtxRangeId_t value_type
Type used for the handle's value.
constexpr range_handle(value_type id) noexcept
Construct a range_handle from the given id.
constexpr value_type get_value() const noexcept
Returns the range_handle's value.
constexpr range_handle() noexcept=default
Constructs a null range handle.
constexpr range_handle(std::nullptr_t) noexcept
Implicit conversion from nullptr constructs a null handle.
Indicates the values of the red, green, and blue color channels for an RGB color to use as an event a...
constexpr rgb(component_type red_, component_type green_, component_type blue_) noexcept
Construct a rgb with red, green, and blue channels specified by red_, green_, and blue_,...
uint8_t component_type
Type used for component values.