NVTX C++ API Reference 1.0
C++ convenience wrappers for NVTX v3 C API
Loading...
Searching...
No Matches
nvtx3.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Licensed under the Apache License v2.0 with LLVM Exceptions.
18 * See https://nvidia.github.io/NVTX/LICENSE.txt for license information.
19 */
20
21/* Temporary helper #defines, #undef'ed at end of header */
22#define NVTX3_CPP_VERSION_MAJOR 1
23#define NVTX3_CPP_VERSION_MINOR 0
24
25/* This section handles the decision of whether to provide unversioned symbols.
26 * If NVTX3_CPP_REQUIRE_EXPLICIT_VERSION is #defined, unversioned symbols are
27 * not provided, and explicit-version symbols such as nvtx3::v1::scoped_range
28 * and NVTX3_V1_FUNC_RANGE must be used. By default, the first #include of this
29 * header will define the unversioned symbols such as nvtx3::scoped_range and
30 * NVTX3_FUNC_RANGE. Subsequently including a different major version of this
31 * header without #defining NVTX3_CPP_REQUIRE_EXPLICIT_VERSION triggers an error
32 * since the symbols would conflict. Subsequently including of a different
33 * minor version within the same major version is allowed. Functionality of
34 * minor versions is cumulative, regardless of include order.
35 *
36 * Since NVTX3_CPP_REQUIRE_EXPLICIT_VERSION allows all combinations of versions
37 * to coexist without problems within a translation unit, the recommended best
38 * practice for instrumenting header-based libraries with NVTX C++ Wrappers is
39 * is to #define NVTX3_CPP_REQUIRE_EXPLICIT_VERSION before including nvtx3.hpp,
40 * #undef it afterward, and only use explicit-version symbols. This is not
41 * necessary in common cases, such as instrumenting a standalone application, or
42 * static/shared libraries in .cpp files or headers private to those projects.
43 */
44/* clang-format off */
45#if !defined(NVTX3_CPP_REQUIRE_EXPLICIT_VERSION)
46 /* Define macro used by all definitions in this header to indicate the
47 * unversioned symbols should be defined in addition to the versioned ones.
48 */
49 #define NVTX3_INLINE_THIS_VERSION
50
51 #if !defined(NVTX3_CPP_INLINED_VERSION_MAJOR)
52 /* First occurrence of this header in the translation unit. Define macros
53 * indicating which version shall be used for unversioned symbols.
54 */
55
66 #define NVTX3_CPP_INLINED_VERSION_MAJOR 1 // NVTX3_CPP_VERSION_MAJOR
67
78 #define NVTX3_CPP_INLINED_VERSION_MINOR 0 // NVTX3_CPP_VERSION_MINOR
79 #elif NVTX3_CPP_INLINED_VERSION_MAJOR != NVTX3_CPP_VERSION_MAJOR
80 /* Unsupported case -- cannot define unversioned symbols for different major versions
81 * in the same translation unit.
82 */
83 #error \
84 "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."
85 #elif (NVTX3_CPP_INLINED_VERSION_MAJOR == NVTX3_CPP_VERSION_MAJOR) && \
86 (NVTX3_CPP_INLINED_VERSION_MINOR < NVTX3_CPP_VERSION_MINOR)
87 /* An older minor version of the same major version already defined unversioned
88 * symbols. The new features provided in this header will be inlined
89 * redefine the minor version macro to this header's version.
90 */
91 #undef NVTX3_CPP_INLINED_VERSION_MINOR
92 #define NVTX3_CPP_INLINED_VERSION_MINOR 0 // NVTX3_CPP_VERSION_MINOR
93 // else, already have this version or newer, nothing to do
94 #endif
95#endif
96/* clang-format on */
97
566/* Temporary helper #defines, removed with #undef at end of header */
567
568/* Some compilers do not correctly support SFINAE, which is used in this API
569 * to detect common usage errors and provide clearer error messages (by using
570 * static_assert) than the compiler would produce otherwise. These compilers
571 * will generate errors while compiling this file such as:
572 *
573 * error: 'name' is not a member of 'nvtx3::v1::domain::global'
574 *
575 * The following compiler versions are known to have this problem, and so are
576 * set by default to disable the SFINAE-based checks:
577 *
578 * - All MSVC versions prior to VS2017 Update 7 (15.7)
579 * - GCC 8.1-8.3 (the problem was fixed in GCC 8.4)
580 *
581 * If you find your compiler hits this problem, you can work around it by
582 * defining NVTX3_USE_CHECKED_OVERLOADS_FOR_GET to 0 before including this
583 * header, or you can add a check for your compiler version to this #if.
584 * Also, please report the issue on the NVTX GitHub page.
585 */
586#if !defined(NVTX3_USE_CHECKED_OVERLOADS_FOR_GET)
587#if defined(_MSC_VER) && _MSC_VER < 1914 \
588 || defined(__GNUC__) && __GNUC__ == 8 && __GNUC_MINOR__ < 4
589#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET 0
590#else
591#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET 1
592#endif
593#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET_DEFINED_HERE
594#endif
595
596/* Within this header, nvtx3::NVTX3_VERSION_NAMESPACE resolves to nvtx3::vX,
597 * where "X" is the major version number. */
598#define NVTX3_CONCAT(A, B) A##B
599#define NVTX3_NAMESPACE_FOR(VERSION) NVTX3_CONCAT(v, VERSION)
600#define NVTX3_VERSION_NAMESPACE NVTX3_NAMESPACE_FOR(NVTX3_CPP_VERSION_MAJOR)
601
602/* Avoid duplicating #if defined(NVTX3_INLINE_THIS_VERSION) for namespaces
603 * in each minor version by making a macro to use unconditionally, which
604 * resolves to "inline" or nothing as appropriate. */
605#if defined(NVTX3_INLINE_THIS_VERSION)
606#define NVTX3_INLINE_IF_REQUESTED inline
607#else
608#define NVTX3_INLINE_IF_REQUESTED
609#endif
610
611/* Enables the use of constexpr when support for C++14 constexpr is present.
612 *
613 * Initialization of a class member that is a union to a specific union member
614 * can only be done in the body of a constructor, not in a member initializer
615 * list. A constexpr constructor must have an empty body until C++14, so there
616 * is no way to make an initializer of a member union constexpr in C++11. This
617 * macro allows making functions constexpr in C++14 or newer, but non-constexpr
618 * in C++11 compilation. It is used here on constructors that initialize their
619 * member unions.
620 */
621#if __cpp_constexpr >= 201304L
622#define NVTX3_CONSTEXPR_IF_CPP14 constexpr
623#else
624#define NVTX3_CONSTEXPR_IF_CPP14
625#endif
626
627// Macro wrappers for C++ attributes
628#if !defined(__has_cpp_attribute)
629#define __has_cpp_attribute(x) 0
630#endif
631#if __has_cpp_attribute(maybe_unused)
632#define NVTX3_MAYBE_UNUSED [[maybe_unused]]
633#else
634#define NVTX3_MAYBE_UNUSED
635#endif
636#if __has_cpp_attribute(nodiscard)
637#define NVTX3_NO_DISCARD [[nodiscard]]
638#else
639#define NVTX3_NO_DISCARD
640#endif
641
642 /* Use a macro for static asserts, which defaults to static_assert, but that
643 * testing tools can replace with a logging function. For example:
644 * #define NVTX3_STATIC_ASSERT(c, m) \
645 * do { if (!(c)) printf("static_assert would fail: %s\n", m); } while (0)
646 */
647#if !defined(NVTX3_STATIC_ASSERT)
648#define NVTX3_STATIC_ASSERT(condition, message) static_assert(condition, message)
649#define NVTX3_STATIC_ASSERT_DEFINED_HERE
650#endif
651
652/* Implementation sections, enclosed in guard macros for each minor version */
653
654#ifndef NVTX3_CPP_DEFINITIONS_V1_0
655#define NVTX3_CPP_DEFINITIONS_V1_0
656
657#include "nvToolsExt.h"
658
659#include <memory>
660#include <string>
661#include <type_traits>
662#include <utility>
663#include <cstddef>
664
665namespace nvtx3 {
666
667NVTX3_INLINE_IF_REQUESTED namespace NVTX3_VERSION_NAMESPACE
668{
669
670namespace detail {
671
672template <typename Unused>
673struct always_false : std::false_type {};
674
675template <typename T, typename = void>
676struct has_name : std::false_type {};
677template <typename T>
678struct has_name<T, decltype((void)T::name, void())> : std::true_type {};
679
680template <typename T, typename = void>
681struct has_id : std::false_type {};
682template <typename T>
683struct has_id<T, decltype((void)T::id, void())> : std::true_type {};
684
685template <typename T, typename = void>
686struct has_message : std::false_type {};
687template <typename T>
688struct has_message<T, decltype((void)T::message, void())> : std::true_type {};
689
690template <typename T, typename = void>
691struct is_c_string : std::false_type {};
692template <typename T>
693struct is_c_string<T, typename std::enable_if<
694 std::is_convertible<T, char const* >::value ||
695 std::is_convertible<T, wchar_t const*>::value
696>::type> : std::true_type {};
697
698template <typename T>
699using is_uint32 = std::is_same<typename std::decay<T>::type, uint32_t>;
700
701} // namespace detail
702
756class domain {
757 public:
758 domain(domain const&) = delete;
759 domain& operator=(domain const&) = delete;
760 domain(domain&&) = delete;
761 domain& operator=(domain&&) = delete;
762
774 struct global {
775 };
776
777#if NVTX3_USE_CHECKED_OVERLOADS_FOR_GET
822 template <typename D = global,
823 typename std::enable_if<
824 detail::is_c_string<decltype(D::name)>::value
825 , int>::type = 0>
826 NVTX3_NO_DISCARD static domain const& get() noexcept
827 {
828 static domain const d(D::name);
829 return d;
830 }
831
837 template <typename D = global,
838 typename std::enable_if<
839 !detail::is_c_string<decltype(D::name)>::value
840 , int>::type = 0>
841 NVTX3_NO_DISCARD static domain const& get() noexcept
842 {
843 NVTX3_STATIC_ASSERT(detail::always_false<D>::value,
844 "Type used to identify an NVTX domain must contain a static constexpr member "
845 "called 'name' of type const char* or const wchar_t* -- 'name' member is not "
846 "convertible to either of those types");
847 static domain const unused;
848 return unused; // Function must compile for static_assert to be triggered
849 }
850
855 template <typename D = global,
856 typename std::enable_if<
857 !detail::has_name<D>::value
858 , int>::type = 0>
859 NVTX3_NO_DISCARD static domain const& get() noexcept
860 {
861 NVTX3_STATIC_ASSERT(detail::always_false<D>::value,
862 "Type used to identify an NVTX domain must contain a static constexpr member "
863 "called 'name' of type const char* or const wchar_t* -- 'name' member is missing");
864 static domain const unused;
865 return unused; // Function must compile for static_assert to be triggered
866 }
867#else
868 template <typename D = global>
869 NVTX3_NO_DISCARD static domain const& get() noexcept
870 {
871 static domain const d(D::name);
872 return d;
873 }
874#endif
875
882 operator nvtxDomainHandle_t() const noexcept { return _domain; }
883
884 private:
893 explicit domain(char const* name) noexcept : _domain{nvtxDomainCreateA(name)} {}
894
903 explicit domain(wchar_t const* name) noexcept : _domain{nvtxDomainCreateW(name)} {}
904
913 explicit domain(std::string const& name) noexcept : domain{name.c_str()} {}
914
923 explicit domain(std::wstring const& name) noexcept : domain{name.c_str()} {}
924
933 constexpr domain() noexcept {}
934
949 ~domain() = default;
950
951 private:
952 nvtxDomainHandle_t const _domain{};
953};
954
968template <>
969NVTX3_NO_DISCARD inline domain const& domain::get<domain::global>() noexcept
970{
971 static domain const d{};
972 return d;
973}
974
980struct rgb {
982 using component_type = uint8_t;
983
994 constexpr rgb(
995 component_type red_,
996 component_type green_,
997 component_type blue_) noexcept
998 : red{red_}, green{green_}, blue{blue_}
999 {
1000 }
1001
1005};
1006
1012struct argb final : rgb {
1025 constexpr argb(
1026 component_type alpha_,
1027 component_type red_,
1028 component_type green_,
1029 component_type blue_) noexcept
1030 : rgb{red_, green_, blue_}, alpha{alpha_}
1031 {
1032 }
1033
1035};
1036
1046class color {
1047 public:
1049 using value_type = uint32_t;
1050
1068 constexpr explicit color(value_type hex_code) noexcept : _value{hex_code} {}
1069
1076 constexpr color(argb argb_) noexcept
1077 : color{from_bytes_msb_to_lsb(argb_.alpha, argb_.red, argb_.green, argb_.blue)}
1078 {
1079 }
1080
1089 constexpr color(rgb rgb_) noexcept
1090 : color{from_bytes_msb_to_lsb(0xFF, rgb_.red, rgb_.green, rgb_.blue)}
1091 {
1092 }
1093
1098 constexpr value_type get_value() const noexcept { return _value; }
1099
1104 constexpr nvtxColorType_t get_type() const noexcept { return _type; }
1105
1106 color() = delete;
1107 ~color() = default;
1108 color(color const&) = default;
1109 color& operator=(color const&) = default;
1110 color(color&&) = default;
1111 color& operator=(color&&) = default;
1112
1113 private:
1119 constexpr static value_type from_bytes_msb_to_lsb(
1120 uint8_t byte3,
1121 uint8_t byte2,
1122 uint8_t byte1,
1123 uint8_t byte0) noexcept
1124 {
1125 return uint32_t{byte3} << 24 | uint32_t{byte2} << 16 | uint32_t{byte1} << 8 | uint32_t{byte0};
1126 }
1127
1128 value_type _value{};
1129 nvtxColorType_t _type{NVTX_COLOR_ARGB};
1130};
1131
1154 public:
1156 using id_type = uint32_t;
1157
1167 constexpr explicit category(id_type id) noexcept : id_{id} {}
1168
1173 constexpr id_type get_id() const noexcept { return id_; }
1174
1175 category() = delete;
1176 ~category() = default;
1177 category(category const&) = default;
1178 category& operator=(category const&) = default;
1179 category(category&&) = default;
1180 category& operator=(category&&) = default;
1181
1182 private:
1183 id_type id_{};
1184};
1185
1235template <typename D = domain::global>
1236class named_category_in final : public category {
1237 public:
1238#if NVTX3_USE_CHECKED_OVERLOADS_FOR_GET
1273 template <typename C,
1274 typename std::enable_if<
1275 detail::is_c_string<decltype(C::name)>::value &&
1276 detail::is_uint32<decltype(C::id)>::value
1277 , int>::type = 0>
1278 static named_category_in const& get() noexcept
1279 {
1280 static named_category_in const cat(C::id, C::name);
1281 return cat;
1282 }
1283
1290 template <typename C,
1291 typename std::enable_if<
1292 !detail::is_c_string<decltype(C::name)>::value ||
1293 !detail::is_uint32<decltype(C::id)>::value
1294 , int>::type = 0>
1295 NVTX3_NO_DISCARD static named_category_in const& get() noexcept
1296 {
1297 NVTX3_STATIC_ASSERT(detail::is_c_string<decltype(C::name)>::value,
1298 "Type used to name an NVTX category must contain a static constexpr member "
1299 "called 'name' of type const char* or const wchar_t* -- 'name' member is not "
1300 "convertible to either of those types");
1301 NVTX3_STATIC_ASSERT(detail::is_uint32<decltype(C::id)>::value,
1302 "Type used to name an NVTX category must contain a static constexpr member "
1303 "called 'id' of type uint32_t -- 'id' member is the wrong type");
1304 static named_category_in const unused;
1305 return unused; // Function must compile for static_assert to be triggered
1306 }
1307
1312 template <typename C,
1313 typename std::enable_if<
1314 !detail::has_name<C>::value ||
1315 !detail::has_id<C>::value
1316 , int>::type = 0>
1317 NVTX3_NO_DISCARD static named_category_in const& get() noexcept
1318 {
1319 NVTX3_STATIC_ASSERT(detail::has_name<C>::value,
1320 "Type used to name an NVTX category must contain a static constexpr member "
1321 "called 'name' of type const char* or const wchar_t* -- 'name' member is missing");
1322 NVTX3_STATIC_ASSERT(detail::has_id<C>::value,
1323 "Type used to name an NVTX category must contain a static constexpr member "
1324 "called 'id' of type uint32_t -- 'id' member is missing");
1325 static named_category_in const unused;
1326 return unused; // Function must compile for static_assert to be triggered
1327 }
1328#else
1329 template <typename C>
1330 NVTX3_NO_DISCARD static named_category_in const& get() noexcept
1331 {
1332 static named_category_in const cat(C::id, C::name);
1333 return cat;
1334 }
1335#endif
1336
1337 private:
1338 // Default constructor is only used internally for static_assert(false) cases.
1339 named_category_in() noexcept : category{0} {}
1340
1341 public:
1352 named_category_in(id_type id, char const* name) noexcept : category{id}
1353 {
1354#ifndef NVTX_DISABLE
1355 nvtxDomainNameCategoryA(domain::get<D>(), get_id(), name);
1356#else
1357 (void)id;
1358 (void)name;
1359#endif
1360 }
1361
1372 named_category_in(id_type id, wchar_t const* name) noexcept : category{id}
1373 {
1374#ifndef NVTX_DISABLE
1375 nvtxDomainNameCategoryW(domain::get<D>(), get_id(), name);
1376#else
1377 (void)id;
1378 (void)name;
1379#endif
1380 }
1381};
1382
1388
1435template <typename D = domain::global>
1437 public:
1438#if NVTX3_USE_CHECKED_OVERLOADS_FOR_GET
1472 template <typename M,
1473 typename std::enable_if<
1474 detail::is_c_string<decltype(M::message)>::value
1475 , int>::type = 0>
1476 NVTX3_NO_DISCARD static registered_string_in const& get() noexcept
1477 {
1478 static registered_string_in const regstr(M::message);
1479 return regstr;
1480 }
1481
1487 template <typename M,
1488 typename std::enable_if<
1489 !detail::is_c_string<decltype(M::message)>::value
1490 , int>::type = 0>
1491 NVTX3_NO_DISCARD static registered_string_in const& get() noexcept
1492 {
1493 NVTX3_STATIC_ASSERT(detail::always_false<M>::value,
1494 "Type used to register an NVTX string must contain a static constexpr member "
1495 "called 'message' of type const char* or const wchar_t* -- 'message' member is "
1496 "not convertible to either of those types");
1497 static registered_string_in const unused;
1498 return unused; // Function must compile for static_assert to be triggered
1499 }
1500
1505 template <typename M,
1506 typename std::enable_if<
1507 !detail::has_message<M>::value
1508 , int>::type = 0>
1509 NVTX3_NO_DISCARD static registered_string_in const& get() noexcept
1510 {
1511 NVTX3_STATIC_ASSERT(detail::always_false<M>::value,
1512 "Type used to register an NVTX string must contain a static constexpr member "
1513 "called 'message' of type const char* or const wchar_t* -- 'message' member "
1514 "is missing");
1515 static registered_string_in const unused;
1516 return unused; // Function must compile for static_assert to be triggered
1517 }
1518#else
1519 template <typename M>
1520 NVTX3_NO_DISCARD static registered_string_in const& get() noexcept
1521 {
1522 static registered_string_in const regstr(M::message);
1523 return regstr;
1524 }
1525#endif
1526
1538 explicit registered_string_in(char const* msg) noexcept
1539 : handle_{nvtxDomainRegisterStringA(domain::get<D>(), msg)}
1540 {
1541 }
1542
1554 explicit registered_string_in(std::string const& msg) noexcept
1555 : registered_string_in{msg.c_str()} {}
1556
1568 explicit registered_string_in(wchar_t const* msg) noexcept
1569 : handle_{nvtxDomainRegisterStringW(domain::get<D>(), msg)}
1570 {
1571 }
1572
1584 explicit registered_string_in(std::wstring const& msg) noexcept
1585 : registered_string_in{msg.c_str()} {}
1586
1591 nvtxStringHandle_t get_handle() const noexcept { return handle_; }
1592
1593private:
1594 // Default constructor is only used internally for static_assert(false) cases.
1595 registered_string_in() noexcept {}
1596public:
1597 ~registered_string_in() = default;
1599 registered_string_in& operator=(registered_string_in const&) = default;
1601 registered_string_in& operator=(registered_string_in&&) = default;
1602
1603 private:
1604 nvtxStringHandle_t handle_{};
1606};
1607
1613
1651class message {
1652 public:
1653 using value_type = nvtxMessageValue_t;
1654
1660 NVTX3_CONSTEXPR_IF_CPP14 message(char const* msg) noexcept : type_{NVTX_MESSAGE_TYPE_ASCII}
1661 {
1662 value_.ascii = msg;
1663 }
1664
1670 message(std::string const& msg) noexcept : message{msg.c_str()} {}
1671
1680 message(std::string&&) = delete;
1681
1687 NVTX3_CONSTEXPR_IF_CPP14 message(wchar_t const* msg) noexcept : type_{NVTX_MESSAGE_TYPE_UNICODE}
1688 {
1689 value_.unicode = msg;
1690 }
1691
1697 message(std::wstring const& msg) noexcept : message{msg.c_str()} {}
1698
1707 message(std::wstring&&) = delete;
1708
1717 template <typename D>
1718 NVTX3_CONSTEXPR_IF_CPP14 message(registered_string_in<D> const& msg) noexcept
1719 : type_{NVTX_MESSAGE_TYPE_REGISTERED}
1720 {
1721 value_.registered = msg.get_handle();
1722 }
1723
1730 constexpr message(
1731 nvtxMessageType_t const& type,
1732 nvtxMessageValue_t const& value) noexcept
1733 : type_{type}, value_(value)
1734 {
1735 }
1736
1742 NVTX3_CONSTEXPR_IF_CPP14 message(nvtxStringHandle_t handle) noexcept
1743 : type_{NVTX_MESSAGE_TYPE_REGISTERED}
1744 {
1745 value_.registered = handle;
1746 }
1747
1752 constexpr value_type get_value() const noexcept { return value_; }
1753
1758 constexpr nvtxMessageType_t get_type() const noexcept { return type_; }
1759
1760 private:
1761 nvtxMessageType_t type_{};
1762 nvtxMessageValue_t value_{};
1763};
1764
1781class payload {
1782 public:
1783 using value_type = typename nvtxEventAttributes_v2::payload_t;
1784
1790 NVTX3_CONSTEXPR_IF_CPP14 explicit payload(int64_t value) noexcept
1791 : type_{NVTX_PAYLOAD_TYPE_INT64}, value_{}
1792 {
1793 value_.llValue = value;
1794 }
1795
1801 NVTX3_CONSTEXPR_IF_CPP14 explicit payload(int32_t value) noexcept
1802 : type_{NVTX_PAYLOAD_TYPE_INT32}, value_{}
1803 {
1804 value_.iValue = value;
1805 }
1806
1812 NVTX3_CONSTEXPR_IF_CPP14 explicit payload(uint64_t value) noexcept
1813 : type_{NVTX_PAYLOAD_TYPE_UNSIGNED_INT64}, value_{}
1814 {
1815 value_.ullValue = value;
1816 }
1817
1823 NVTX3_CONSTEXPR_IF_CPP14 explicit payload(uint32_t value) noexcept
1824 : type_{NVTX_PAYLOAD_TYPE_UNSIGNED_INT32}, value_{}
1825 {
1826 value_.uiValue = value;
1827 }
1828
1835 NVTX3_CONSTEXPR_IF_CPP14 explicit payload(float value) noexcept
1836 : type_{NVTX_PAYLOAD_TYPE_FLOAT}, value_{}
1837 {
1838 value_.fValue = value;
1839 }
1840
1847 NVTX3_CONSTEXPR_IF_CPP14 explicit payload(double value) noexcept
1848 : type_{NVTX_PAYLOAD_TYPE_DOUBLE}, value_{}
1849 {
1850 value_.dValue = value;
1851 }
1852
1859 constexpr payload(
1860 nvtxPayloadType_t const& type,
1861 value_type const& value) noexcept
1862 : type_{type}, value_(value)
1863 {
1864 }
1865
1870 constexpr value_type get_value() const noexcept { return value_; }
1871
1876 constexpr nvtxPayloadType_t get_type() const noexcept { return type_; }
1877
1878 private:
1879 nvtxPayloadType_t type_;
1880 value_type value_;
1881};
1882
1942 public:
1943 using value_type = nvtxEventAttributes_t;
1944
1949 constexpr event_attributes() noexcept
1950 : attributes_{
1951 NVTX_VERSION, // version
1952 sizeof(nvtxEventAttributes_t), // size
1953 0, // category
1954 NVTX_COLOR_UNKNOWN, // color type
1955 0, // color value
1956 NVTX_PAYLOAD_UNKNOWN, // payload type
1957 0, // reserved 4B
1958 {0}, // payload value (union)
1959 NVTX_MESSAGE_UNKNOWN, // message type
1960 {0} // message value (union)
1961 }
1962 {
1963 }
1964
1972 template <typename... Args>
1973 NVTX3_CONSTEXPR_IF_CPP14 explicit event_attributes(category const& c, Args const&... args) noexcept
1974 : event_attributes(args...)
1975 {
1976 attributes_.category = c.get_id();
1977 }
1978
1986 template <typename... Args>
1987 NVTX3_CONSTEXPR_IF_CPP14 explicit event_attributes(color const& c, Args const&... args) noexcept
1988 : event_attributes(args...)
1989 {
1990 attributes_.color = c.get_value();
1991 attributes_.colorType = c.get_type();
1992 }
1993
2001 template <typename... Args>
2002 NVTX3_CONSTEXPR_IF_CPP14 explicit event_attributes(payload const& p, Args const&... args) noexcept
2003 : event_attributes(args...)
2004 {
2005 attributes_.payload = p.get_value();
2006 attributes_.payloadType = p.get_type();
2007 }
2008
2016 template <typename... Args>
2017 NVTX3_CONSTEXPR_IF_CPP14 explicit event_attributes(message const& m, Args const&... args) noexcept
2018 : event_attributes(args...)
2019 {
2020 attributes_.message = m.get_value();
2021 attributes_.messageType = m.get_type();
2022 }
2023
2024 ~event_attributes() = default;
2025 event_attributes(event_attributes const&) = default;
2026 event_attributes& operator=(event_attributes const&) = default;
2028 event_attributes& operator=(event_attributes&&) = default;
2029
2034 constexpr value_type const* get() const noexcept { return &attributes_; }
2035
2036 private:
2037 value_type attributes_{};
2038};
2039
2087template <class D = domain::global>
2088class NVTX3_MAYBE_UNUSED scoped_range_in {
2089 public:
2104 explicit scoped_range_in(event_attributes const& attr) noexcept
2105 {
2106#ifndef NVTX_DISABLE
2107 nvtxDomainRangePushEx(domain::get<D>(), attr.get());
2108#else
2109 (void)attr;
2110#endif
2111 }
2112
2133 template <typename... Args>
2134 explicit scoped_range_in(Args const&... args) noexcept
2136 {
2137 }
2138
2145
2152 void* operator new(std::size_t) = delete;
2153
2154 scoped_range_in(scoped_range_in const&) = delete;
2155 scoped_range_in& operator=(scoped_range_in const&) = delete;
2156 scoped_range_in(scoped_range_in&&) = delete;
2157 scoped_range_in& operator=(scoped_range_in&&) = delete;
2158
2163 {
2164#ifndef NVTX_DISABLE
2165 nvtxDomainRangePop(domain::get<D>());
2166#endif
2167 }
2168};
2169
2175
2176namespace detail {
2177
2179template <typename D = domain::global>
2180class NVTX3_MAYBE_UNUSED optional_scoped_range_in
2181{
2182public:
2183 optional_scoped_range_in() = default;
2184
2185 void begin(event_attributes const& attr) noexcept
2186 {
2187#ifndef NVTX_DISABLE
2188 // This class is not meant to be part of the public NVTX C++ API and should
2189 // only be used in the `NVTX3_FUNC_RANGE_IF` and `NVTX3_FUNC_RANGE_IF_IN`
2190 // macros. However, to prevent developers from misusing this class, make
2191 // sure to not start multiple ranges.
2192 if (initialized) { return; }
2193
2194 nvtxDomainRangePushEx(domain::get<D>(), attr.get());
2195 initialized = true;
2196#endif
2197 }
2198
2199 ~optional_scoped_range_in() noexcept
2200 {
2201#ifndef NVTX_DISABLE
2202 if (initialized) { nvtxDomainRangePop(domain::get<D>()); }
2203#endif
2204 }
2205
2206 void* operator new(std::size_t) = delete;
2207 optional_scoped_range_in(optional_scoped_range_in const&) = delete;
2208 optional_scoped_range_in& operator=(optional_scoped_range_in const&) = delete;
2209 optional_scoped_range_in(optional_scoped_range_in&&) = delete;
2210 optional_scoped_range_in& operator=(optional_scoped_range_in&&) = delete;
2211
2212private:
2213#ifndef NVTX_DISABLE
2214 bool initialized = false;
2215#endif
2216};
2218
2219} // namespace detail
2220
2229 using value_type = nvtxRangeId_t;
2230
2231
2236 constexpr explicit range_handle(value_type id) noexcept : _range_id{id} {}
2237
2245 constexpr range_handle() noexcept = default;
2246
2258 constexpr explicit operator bool() const noexcept { return get_value() != null_range_id; }
2259
2266 constexpr range_handle(std::nullptr_t) noexcept {}
2267
2273 constexpr value_type get_value() const noexcept { return _range_id; }
2274
2275 private:
2277 static constexpr value_type null_range_id = nvtxRangeId_t{0};
2278
2279 value_type _range_id{null_range_id};
2280};
2281
2288inline constexpr bool operator==(range_handle lhs, range_handle rhs) noexcept
2289{
2290 return lhs.get_value() == rhs.get_value();
2291}
2292
2299inline constexpr bool operator!=(range_handle lhs, range_handle rhs) noexcept { return !(lhs == rhs); }
2300
2330template <typename D = domain::global>
2331NVTX3_NO_DISCARD inline range_handle start_range_in(event_attributes const& attr) noexcept
2332{
2333#ifndef NVTX_DISABLE
2334 return range_handle{nvtxDomainRangeStartEx(domain::get<D>(), attr.get())};
2335#else
2336 (void)attr;
2337 return {};
2338#endif
2339}
2340
2371template <typename D = domain::global, typename... Args>
2372NVTX3_NO_DISCARD inline range_handle start_range_in(Args const&... args) noexcept
2373{
2374#ifndef NVTX_DISABLE
2375 return start_range_in<D>(event_attributes{args...});
2376#else
2377 return {};
2378#endif
2379}
2380
2407NVTX3_NO_DISCARD inline range_handle start_range(event_attributes const& attr) noexcept
2408{
2409#ifndef NVTX_DISABLE
2410 return start_range_in<domain::global>(attr);
2411#else
2412 (void)attr;
2413 return {};
2414#endif
2415}
2416
2444template <typename... Args>
2445NVTX3_NO_DISCARD inline range_handle start_range(Args const&... args) noexcept
2446{
2447#ifndef NVTX_DISABLE
2448 return start_range_in<domain::global>(args...);
2449#else
2450 return {};
2451#endif
2452}
2453
2469template <typename D = domain::global>
2470inline void end_range_in(range_handle r) noexcept
2471{
2472#ifndef NVTX_DISABLE
2473 nvtxDomainRangeEnd(domain::get<D>(), r.get_value());
2474#else
2475 (void)r;
2476#endif
2477}
2478
2492inline void end_range(range_handle r) noexcept
2493{
2494#ifndef NVTX_DISABLE
2495 end_range_in<domain::global>(r);
2496#else
2497 (void)r;
2498#endif
2499}
2500
2522template <typename D = domain::global>
2523class NVTX3_MAYBE_UNUSED unique_range_in {
2524 public:
2538 explicit unique_range_in(event_attributes const& attr) noexcept
2539 : handle_{start_range_in<D>(attr)}
2540 {
2541 }
2542
2562 template <typename... Args>
2563 explicit unique_range_in(Args const&... args) noexcept
2565 {
2566 }
2567
2574
2579 ~unique_range_in() noexcept = default;
2580
2587 unique_range_in(unique_range_in&& other) noexcept = default;
2588
2595 unique_range_in& operator=(unique_range_in&& other) noexcept = default;
2596
2600
2603 unique_range_in& operator=(unique_range_in const&) = delete;
2604
2605 private:
2606
2607 struct end_range_handle {
2608 using pointer = range_handle;
2609 void operator()(range_handle h) const noexcept { end_range_in<D>(h); }
2610 };
2611
2613 std::unique_ptr<range_handle, end_range_handle> handle_;
2614};
2615
2621
2645template <typename D = domain::global>
2646inline void mark_in(event_attributes const& attr) noexcept
2647{
2648#ifndef NVTX_DISABLE
2649 nvtxDomainMarkEx(domain::get<D>(), attr.get());
2650#else
2651 (void)(attr);
2652#endif
2653}
2654
2682template <typename D = domain::global, typename... Args>
2683inline void mark_in(Args const&... args) noexcept
2684{
2685#ifndef NVTX_DISABLE
2686 mark_in<D>(event_attributes{args...});
2687#endif
2688}
2689
2710inline void mark(event_attributes const& attr) noexcept
2711{
2712#ifndef NVTX_DISABLE
2713 mark_in<domain::global>(attr);
2714#endif
2715}
2716
2741template <typename... Args>
2742inline void mark(Args const&... args) noexcept
2743{
2744#ifndef NVTX_DISABLE
2745 mark_in<domain::global>(args...);
2746#endif
2747}
2748
2749} // namespace NVTX3_VERSION_NAMESPACE
2750
2751} // namespace nvtx3
2752
2753#ifndef NVTX_DISABLE
2782#define NVTX3_V1_FUNC_RANGE_IN(D) \
2783 static ::nvtx3::v1::registered_string_in<D> const nvtx3_func_name__{__func__}; \
2784 static ::nvtx3::v1::event_attributes const nvtx3_func_attr__{nvtx3_func_name__}; \
2785 ::nvtx3::v1::scoped_range_in<D> const nvtx3_range__{nvtx3_func_attr__};
2786
2803#define NVTX3_V1_FUNC_RANGE_IF_IN(D, C) \
2804 ::nvtx3::v1::detail::optional_scoped_range_in<D> optional_nvtx3_range__; \
2805 if (C) { \
2806 static ::nvtx3::v1::registered_string_in<D> const nvtx3_func_name__{__func__}; \
2807 static ::nvtx3::v1::event_attributes const nvtx3_func_attr__{nvtx3_func_name__}; \
2808 optional_nvtx3_range__.begin(nvtx3_func_attr__); \
2809 }
2810#else
2811#define NVTX3_V1_FUNC_RANGE_IN(D)
2812#define NVTX3_V1_FUNC_RANGE_IF_IN(D, C)
2813#endif // NVTX_DISABLE
2814
2837#define NVTX3_V1_FUNC_RANGE() NVTX3_V1_FUNC_RANGE_IN(::nvtx3::v1::domain::global)
2838
2850#define NVTX3_V1_FUNC_RANGE_IF(C) NVTX3_V1_FUNC_RANGE_IF_IN(::nvtx3::v1::domain::global, C)
2851
2852/* When inlining this version, versioned macros must have unversioned aliases.
2853 * For each NVTX3_Vx_ #define, make an NVTX3_ alias of it here.*/
2854#if defined(NVTX3_INLINE_THIS_VERSION)
2855/* clang format off */
2856#define NVTX3_FUNC_RANGE NVTX3_V1_FUNC_RANGE
2857#define NVTX3_FUNC_RANGE_IF NVTX3_V1_FUNC_RANGE_IF
2858#define NVTX3_FUNC_RANGE_IN NVTX3_V1_FUNC_RANGE_IN
2859#define NVTX3_FUNC_RANGE_IF_IN NVTX3_V1_FUNC_RANGE_IF_IN
2860/* clang format on */
2861#endif
2862
2863#endif // NVTX3_CPP_DEFINITIONS_V1_0
2864
2865/* Add functionality for new minor versions here, by copying the above section enclosed
2866 * in #ifndef NVTX3_CPP_DEFINITIONS_Vx_y, and incrementing the minor version. This code
2867 * is an example of how additions for version 1.2 would look, indented for clarity. Note
2868 * that the versioned symbols and macros are always provided, and the unversioned symbols
2869 * are only provided if NVTX3_INLINE_THIS_VERSION was defined at the top of this header.
2870 *
2871 * \code{.cpp}
2872 * #ifndef NVTX3_CPP_DEFINITIONS_V1_2
2873 * #define NVTX3_CPP_DEFINITIONS_V1_2
2874 * namespace nvtx3 {
2875 * NVTX3_INLINE_IF_REQUESTED namespace NVTX3_VERSION_NAMESPACE {
2876 * class new_class {};
2877 * inline void new_function() {}
2878 * }
2879 * }
2880 *
2881 * // Macros must have the major version in their names:
2882 * #define NVTX3_V1_NEW_MACRO_A() ...
2883 * #define NVTX3_V1_NEW_MACRO_B() ...
2884 *
2885 * // If inlining, make aliases for the macros with the version number omitted
2886 * #if defined(NVTX3_INLINE_THIS_VERSION)
2887 * #define NVTX3_NEW_MACRO_A NVTX3_V1_NEW_MACRO_A
2888 * #define NVTX3_NEW_MACRO_B NVTX3_V1_NEW_MACRO_B
2889 * #endif
2890 * #endif // NVTX3_CPP_DEFINITIONS_V1_2
2891 * \endcode
2892 */
2893
2894/* Undefine all temporarily-defined unversioned macros, which would conflict with
2895 * subsequent includes of different versions of this header. */
2896#undef NVTX3_CPP_VERSION_MAJOR
2897#undef NVTX3_CPP_VERSION_MINOR
2898#undef NVTX3_CONCAT
2899#undef NVTX3_NAMESPACE_FOR
2900#undef NVTX3_VERSION_NAMESPACE
2901#undef NVTX3_INLINE_IF_REQUESTED
2902#undef NVTX3_CONSTEXPR_IF_CPP14
2903#undef NVTX3_MAYBE_UNUSED
2904#undef NVTX3_NO_DISCARD
2905
2906#if defined(NVTX3_INLINE_THIS_VERSION)
2907#undef NVTX3_INLINE_THIS_VERSION
2908#endif
2909
2910#if defined(NVTX3_USE_CHECKED_OVERLOADS_FOR_GET_DEFINED_HERE)
2911#undef NVTX3_USE_CHECKED_OVERLOADS_FOR_GET_DEFINED_HERE
2912#undef NVTX3_USE_CHECKED_OVERLOADS_FOR_GET
2913#endif
2914
2915#if defined(NVTX3_STATIC_ASSERT_DEFINED_HERE)
2916#undef NVTX3_STATIC_ASSERT_DEFINED_HERE
2917#undef NVTX3_STATIC_ASSERT
2918#endif
Object for intra-domain grouping of NVTX events.
Definition nvtx3.hpp:1153
constexpr category(id_type id) noexcept
Construct a category with the specified id.
Definition nvtx3.hpp:1167
constexpr id_type get_id() const noexcept
Returns the id of the category.
Definition nvtx3.hpp:1173
uint32_t id_type
Type used for categorys integer id.
Definition nvtx3.hpp:1156
Represents a custom color that can be associated with an NVTX event via its event_attributes.
Definition nvtx3.hpp:1046
constexpr value_type get_value() const noexcept
Returns the colors argb hex code.
Definition nvtx3.hpp:1098
constexpr color(rgb rgb_) noexcept
Construct a color using the red, green, blue components in rgb.
Definition nvtx3.hpp:1089
uint32_t value_type
Type used for the color's value.
Definition nvtx3.hpp:1049
constexpr color(value_type hex_code) noexcept
Constructs a color using the value provided by hex_code.
Definition nvtx3.hpp:1068
constexpr color(argb argb_) noexcept
Construct a color using the alpha, red, green, blue components in argb.
Definition nvtx3.hpp:1076
constexpr nvtxColorType_t get_type() const noexcept
Return the NVTX color type of the color.
Definition nvtx3.hpp:1104
domains allow for grouping NVTX events into a single scope to differentiate them from events in other...
Definition nvtx3.hpp:756
static domain const & get() noexcept
Returns reference to an instance of a function local static domain object.
Definition nvtx3.hpp:826
Describes the attributes of a NVTX event.
Definition nvtx3.hpp:1941
event_attributes(color const &c, Args const &... args) noexcept
Variadic constructor where the first argument is a color.
Definition nvtx3.hpp:1987
event_attributes(category const &c, Args const &... args) noexcept
Variadic constructor where the first argument is a category.
Definition nvtx3.hpp:1973
constexpr value_type const * get() const noexcept
Get raw pointer to underlying NVTX attributes object.
Definition nvtx3.hpp:2034
event_attributes(payload const &p, Args const &... args) noexcept
Variadic constructor where the first argument is a payload.
Definition nvtx3.hpp:2002
event_attributes(message const &m, Args const &... args) noexcept
Variadic constructor where the first argument is a message.
Definition nvtx3.hpp:2017
constexpr event_attributes() noexcept
Default constructor creates an event_attributes with no category, color, payload, nor message.
Definition nvtx3.hpp:1949
Allows associating a message string with an NVTX event via its EventAttributes.
Definition nvtx3.hpp:1651
message(std::string const &msg) noexcept
Construct a message whose contents are specified by msg.
Definition nvtx3.hpp:1670
message(wchar_t const *msg) noexcept
Construct a message whose contents are specified by msg.
Definition nvtx3.hpp:1687
constexpr value_type get_value() const noexcept
Return the union holding the value of the message.
Definition nvtx3.hpp:1752
message(registered_string_in< D > const &msg) noexcept
Construct a message from a registered_string_in.
Definition nvtx3.hpp:1718
message(std::wstring &&)=delete
Disallow construction for std::wstring r-value.
constexpr nvtxMessageType_t get_type() const noexcept
Return the type information about the value the union holds.
Definition nvtx3.hpp:1758
message(nvtxStringHandle_t handle) noexcept
Construct a message from NVTX C API registered string handle.
Definition nvtx3.hpp:1742
message(char const *msg) noexcept
Construct a message whose contents are specified by msg.
Definition nvtx3.hpp:1660
constexpr message(nvtxMessageType_t const &type, nvtxMessageValue_t const &value) noexcept
Construct a message from NVTX C API type and value.
Definition nvtx3.hpp:1730
message(std::string &&)=delete
Disallow construction for std::string r-value.
message(std::wstring const &msg) noexcept
Construct a message whose contents are specified by msg.
Definition nvtx3.hpp:1697
A category with an associated name string.
Definition nvtx3.hpp:1236
named_category_in(id_type id, wchar_t const *name) noexcept
Construct a named_category_in with the specified id and name.
Definition nvtx3.hpp:1372
static named_category_in const & get() noexcept
Returns a global instance of a named_category_in as a function-local static.
Definition nvtx3.hpp:1278
named_category_in(id_type id, char const *name) noexcept
Construct a named_category_in with the specified id and name.
Definition nvtx3.hpp:1352
A numerical value that can be associated with an NVTX event via its event_attributes.
Definition nvtx3.hpp:1781
payload(int32_t value) noexcept
Construct a payload from a signed, 4 byte integer.
Definition nvtx3.hpp:1801
constexpr payload(nvtxPayloadType_t const &type, value_type const &value) noexcept
Construct a payload from NVTX C API type and value.
Definition nvtx3.hpp:1859
payload(uint32_t value) noexcept
Construct a payload from an unsigned, 4 byte integer.
Definition nvtx3.hpp:1823
payload(int64_t value) noexcept
Construct a payload from a signed, 8 byte integer.
Definition nvtx3.hpp:1790
payload(float value) noexcept
Construct a payload from a single-precision floating point value.
Definition nvtx3.hpp:1835
payload(double value) noexcept
Construct a payload from a double-precision floating point value.
Definition nvtx3.hpp:1847
constexpr value_type get_value() const noexcept
Return the union holding the value of the payload.
Definition nvtx3.hpp:1870
constexpr nvtxPayloadType_t get_type() const noexcept
Return the information about the type the union holds.
Definition nvtx3.hpp:1876
payload(uint64_t value) noexcept
Construct a payload from an unsigned, 8 byte integer.
Definition nvtx3.hpp:1812
A message registered with NVTX.
Definition nvtx3.hpp:1436
registered_string_in(char const *msg) noexcept
Constructs a registered_string_in from the specified msg string.
Definition nvtx3.hpp:1538
nvtxStringHandle_t get_handle() const noexcept
Returns the registered string's handle.
Definition nvtx3.hpp:1591
registered_string_in(std::string const &msg) noexcept
Constructs a registered_string_in from the specified msg string.
Definition nvtx3.hpp:1554
registered_string_in(std::wstring const &msg) noexcept
Constructs a registered_string_in from the specified msg string.
Definition nvtx3.hpp:1584
registered_string_in(wchar_t const *msg) noexcept
Constructs a registered_string_in from the specified msg string.
Definition nvtx3.hpp:1568
static registered_string_in const & get() noexcept
Returns a global instance of a registered_string_in as a function local static.
Definition nvtx3.hpp:1476
A RAII object for creating a NVTX range local to a thread within a domain.
Definition nvtx3.hpp:2088
scoped_range_in(event_attributes const &attr) noexcept
Construct a scoped_range_in with the specified event_attributes
Definition nvtx3.hpp:2104
scoped_range_in(Args const &... args) noexcept
Constructs a scoped_range_in from the constructor arguments of an event_attributes.
Definition nvtx3.hpp:2134
scoped_range_in() noexcept
Default constructor creates a scoped_range_in with no message, color, payload, nor category.
Definition nvtx3.hpp:2144
~scoped_range_in() noexcept
Destroy the scoped_range_in, ending the NVTX range event.
Definition nvtx3.hpp:2162
A RAII object for creating a NVTX range within a domain that can be created and destroyed on differen...
Definition nvtx3.hpp:2523
constexpr unique_range_in() noexcept
Default constructor creates a unique_range_in with no message, color, payload, nor category.
Definition nvtx3.hpp:2573
~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.
Definition nvtx3.hpp:2563
unique_range_in(event_attributes const &attr) noexcept
Construct a new unique_range_in object with the specified event attributes.
Definition nvtx3.hpp:2538
void end_range_in(range_handle r) noexcept
Manually end the range associated with the handle r in domain D.
Definition nvtx3.hpp:2470
void mark_in(event_attributes const &attr) noexcept
Annotates an instantaneous point in time with a "marker", using the attributes specified by attr.
Definition nvtx3.hpp:2646
range_handle start_range_in(event_attributes const &attr) noexcept
Manually begin an NVTX range.
Definition nvtx3.hpp:2331
range_handle start_range(event_attributes const &attr) noexcept
Manually begin an NVTX range in the global domain.
Definition nvtx3.hpp:2407
constexpr bool operator==(range_handle lhs, range_handle rhs) noexcept
Compares two range_handles for equality.
Definition nvtx3.hpp:2288
void mark(event_attributes const &attr) noexcept
Annotates an instantaneous point in time with a "marker", using the attributes specified by attr,...
Definition nvtx3.hpp:2710
constexpr bool operator!=(range_handle lhs, range_handle rhs) noexcept
Compares two range_handles for inequality.
Definition nvtx3.hpp:2299
void end_range(range_handle r) noexcept
Manually end the range associated with the handle r in the global domain.
Definition nvtx3.hpp:2492
Indicates the value of the alpha, red, green, and blue color channels for an ARGB color to use as an ...
Definition nvtx3.hpp:1012
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_,...
Definition nvtx3.hpp:1025
Tag type for the "global" NVTX domain.
Definition nvtx3.hpp:774
Handle used for correlating explicit range start and end events.
Definition nvtx3.hpp:2227
constexpr range_handle(value_type id) noexcept
Construct a range_handle from the given id.
Definition nvtx3.hpp:2236
constexpr value_type get_value() const noexcept
Returns the range_handle's value.
Definition nvtx3.hpp:2273
constexpr range_handle() noexcept=default
Constructs a null range handle.
nvtxRangeId_t value_type
Type used for the handle's value.
Definition nvtx3.hpp:2229
constexpr range_handle(std::nullptr_t) noexcept
Implicit conversion from nullptr constructs a null handle.
Definition nvtx3.hpp:2266
Indicates the values of the red, green, and blue color channels for an RGB color to use as an event a...
Definition nvtx3.hpp:980
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_,...
Definition nvtx3.hpp:994
uint8_t component_type
Type used for component values.
Definition nvtx3.hpp:982