NVTX C++ API Reference 1.0
C++ convenience wrappers for NVTX v3 C API
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
nvtx3.hpp File Reference

Provides C++ constructs making the NVTX library safer and easier to use with zero overhead. More...

Include dependency graph for nvtx3.hpp:

Go to the source code of this file.

Classes

class  nvtx3::v1::domain
 domains allow for grouping NVTX events into a single scope to differentiate them from events in other domains. More...
 
struct  nvtx3::v1::domain::global
 Tag type for the "global" NVTX domain. More...
 
struct  nvtx3::v1::rgb
 Indicates the values of the red, green, and blue color channels for an RGB color to use as an event attribute (assumes no transparency). More...
 
struct  nvtx3::v1::argb
 Indicates the value of the alpha, red, green, and blue color channels for an ARGB color to use as an event attribute. More...
 
class  nvtx3::v1::color
 Represents a custom color that can be associated with an NVTX event via it's event_attributes. More...
 
class  nvtx3::v1::category
 Object for intra-domain grouping of NVTX events. More...
 
class  nvtx3::v1::named_category_in< D >
 A category with an associated name string. More...
 
class  nvtx3::v1::registered_string_in< D >
 A message registered with NVTX. More...
 
class  nvtx3::v1::message
 Allows associating a message string with an NVTX event via its EventAttributes. More...
 
class  nvtx3::v1::payload
 A numerical value that can be associated with an NVTX event via its event_attributes. More...
 
class  nvtx3::v1::event_attributes
 Describes the attributes of a NVTX event. More...
 
class  nvtx3::v1::scoped_range_in< D >
 A RAII object for creating a NVTX range local to a thread within a domain. More...
 
struct  nvtx3::v1::range_handle
 Handle used for correlating explicit range start and end events. More...
 
class  nvtx3::v1::unique_range_in< D >
 A RAII object for creating a NVTX range within a domain that can be created and destroyed on different threads. More...
 

Macros

#define NVTX3_CPP_VERSION_MAJOR   1
 
#define NVTX3_CPP_VERSION_MINOR   0
 
#define NVTX3_INLINE_THIS_VERSION
 
#define NVTX3_CPP_INLINED_VERSION_MAJOR   1
 Semantic major version number for NVTX C++ wrappers of unversioned symbols. More...
 
#define NVTX3_CPP_INLINED_VERSION_MINOR   0
 Semantic minor version number for NVTX C++ wrappers of unversioned symbols. More...
 
#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET   1
 
#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET_DEFINED_HERE
 
#define NVTX3_CONCAT(A, B)   A##B
 
#define NVTX3_NAMESPACE_FOR(VERSION)   NVTX3_CONCAT(v, VERSION)
 
#define NVTX3_VERSION_NAMESPACE   NVTX3_NAMESPACE_FOR(NVTX3_CPP_VERSION_MAJOR)
 
#define NVTX3_INLINE_IF_REQUESTED   inline
 
#define NVTX3_CONSTEXPR_IF_CPP14
 
#define NVTX3_STATIC_ASSERT(condition, message)   static_assert(condition, message);
 
#define NVTX3_STATIC_ASSERT_DEFINED_HERE
 
#define NVTX3_CPP_DEFINITIONS_V1_0
 
#define NVTX3_V1_FUNC_RANGE_IN(D)
 Convenience macro for generating a range in the specified domain from the lifetime of a function. More...
 
#define NVTX3_V1_FUNC_RANGE_IF_IN(D, C)
 Convenience macro for generating a range in the specified domain from the lifetime of a function if the given boolean expression evaluates to true. More...
 
#define NVTX3_V1_FUNC_RANGE()   NVTX3_V1_FUNC_RANGE_IN(::nvtx3::v1::domain::global)
 Convenience macro for generating a range in the global domain from the lifetime of a function. More...
 
#define NVTX3_V1_FUNC_RANGE_IF(C)   NVTX3_V1_FUNC_RANGE_IF_IN(::nvtx3::v1::domain::global, C)
 Convenience macro for generating a range in the global domain from the lifetime of a function if the given boolean expression evaluates to true. More...
 
#define NVTX3_FUNC_RANGE   NVTX3_V1_FUNC_RANGE
 
#define NVTX3_FUNC_RANGE_IF   NVTX3_V1_FUNC_RANGE_IF
 
#define NVTX3_FUNC_RANGE_IN   NVTX3_V1_FUNC_RANGE_IN
 
#define NVTX3_FUNC_RANGE_IF_IN   NVTX3_V1_FUNC_RANGE_IF_IN
 

Typedefs

template<typename T >
using nvtx3::v1::detail::is_uint32 = std::is_same< typename std::decay< T >::type, uint32_t >
 
using nvtx3::named_category = named_category_in< domain::global >
 Alias for a named_category_in in the global NVTX domain. More...
 
using nvtx3::registered_string = registered_string_in< domain::global >
 Alias for a registered_string_in in the global NVTX domain. More...
 
using nvtx3::scoped_range = scoped_range_in< domain::global >
 Alias for a scoped_range_in in the global NVTX domain. More...
 
using nvtx3::unique_range = unique_range_in< domain::global >
 Alias for a unique_range_in in the global NVTX domain. More...
 

Functions

template<>
domain const & nvtx3::domain::get< domain::global > () noexcept
 Returns reference to the domain object that represents the global NVTX domain. More...
 
constexpr bool nvtx3::operator== (range_handle lhs, range_handle rhs) noexcept
 Compares two range_handles for equality. More...
 
constexpr bool nvtx3::operator!= (range_handle lhs, range_handle rhs) noexcept
 Compares two range_handles for inequality. More...
 
template<typename D = domain::global>
range_handle nvtx3::start_range_in (event_attributes const &attr) noexcept
 Manually begin an NVTX range. More...
 
template<typename D = domain::global, typename... Args>
range_handle nvtx3::start_range_in (Args const &... args) noexcept
 Manually begin an NVTX range. More...
 
range_handle nvtx3::start_range (event_attributes const &attr) noexcept
 Manually begin an NVTX range in the global domain. More...
 
template<typename... Args>
range_handle nvtx3::start_range (Args const &... args) noexcept
 Manually begin an NVTX range in the global domain. More...
 
template<typename D = domain::global>
void nvtx3::end_range_in (range_handle r) noexcept
 Manually end the range associated with the handle r in domain D. More...
 
void nvtx3::end_range (range_handle r) noexcept
 Manually end the range associated with the handle r in the global domain. More...
 
template<typename D = domain::global>
void nvtx3::mark_in (event_attributes const &attr) noexcept
 Annotates an instantaneous point in time with a "marker", using the attributes specified by attr. More...
 
template<typename D = domain::global, typename... Args>
void nvtx3::mark_in (Args const &... args) noexcept
 Annotates an instantaneous point in time with a "marker", using the arguments to construct an event_attributes. More...
 
void nvtx3::mark (event_attributes const &attr) noexcept
 Annotates an instantaneous point in time with a "marker", using the attributes specified by attr, in the global domain. More...
 
template<typename... Args>
void nvtx3::mark (Args const &... args) noexcept
 Annotates an instantaneous point in time with a "marker", using the arguments to construct an event_attributes, in the global domain. More...
 

Detailed Description

Provides C++ constructs making the NVTX library safer and easier to use with zero overhead.

Definition in file nvtx3.hpp.

Macro Definition Documentation

◆ NVTX3_CONCAT

#define NVTX3_CONCAT (   A,
 
)    A##B

Definition at line 585 of file nvtx3.hpp.

◆ NVTX3_CONSTEXPR_IF_CPP14

#define NVTX3_CONSTEXPR_IF_CPP14

Definition at line 611 of file nvtx3.hpp.

◆ NVTX3_CPP_DEFINITIONS_V1_0

#define NVTX3_CPP_DEFINITIONS_V1_0

Definition at line 627 of file nvtx3.hpp.

◆ NVTX3_CPP_INLINED_VERSION_MAJOR

#define NVTX3_CPP_INLINED_VERSION_MAJOR   1

Semantic major version number for NVTX C++ wrappers of unversioned symbols.

Breaking changes may occur between major versions, and different major versions cannot provide unversioned symbols in the same translation unit (.cpp file).

Note: If NVTX3_CPP_REQUIRE_EXPLICIT_VERSION is defined, this macro is not defined.

Not to be confused with the version number of the NVTX core library.

Definition at line 62 of file nvtx3.hpp.

◆ NVTX3_CPP_INLINED_VERSION_MINOR

#define NVTX3_CPP_INLINED_VERSION_MINOR   0

Semantic minor version number for NVTX C++ wrappers of unversioned symbols.

No breaking changes occur between minor versions – minor version changes within a major version are purely additive.

Note: If NVTX3_CPP_REQUIRE_EXPLICIT_VERSION is defined, this macro is not defined.

Not to be confused with the version number of the NVTX core library.

Definition at line 74 of file nvtx3.hpp.

◆ NVTX3_CPP_VERSION_MAJOR

#define NVTX3_CPP_VERSION_MAJOR   1

Definition at line 18 of file nvtx3.hpp.

◆ NVTX3_CPP_VERSION_MINOR

#define NVTX3_CPP_VERSION_MINOR   0

Definition at line 19 of file nvtx3.hpp.

◆ NVTX3_FUNC_RANGE

#define NVTX3_FUNC_RANGE   NVTX3_V1_FUNC_RANGE

Definition at line 2828 of file nvtx3.hpp.

◆ NVTX3_FUNC_RANGE_IF

#define NVTX3_FUNC_RANGE_IF   NVTX3_V1_FUNC_RANGE_IF

Definition at line 2829 of file nvtx3.hpp.

◆ NVTX3_FUNC_RANGE_IF_IN

#define NVTX3_FUNC_RANGE_IF_IN   NVTX3_V1_FUNC_RANGE_IF_IN

Definition at line 2831 of file nvtx3.hpp.

◆ NVTX3_FUNC_RANGE_IN

#define NVTX3_FUNC_RANGE_IN   NVTX3_V1_FUNC_RANGE_IN

Definition at line 2830 of file nvtx3.hpp.

◆ NVTX3_INLINE_IF_REQUESTED

#define NVTX3_INLINE_IF_REQUESTED   inline

Definition at line 593 of file nvtx3.hpp.

◆ NVTX3_INLINE_THIS_VERSION

#define NVTX3_INLINE_THIS_VERSION

Definition at line 45 of file nvtx3.hpp.

◆ NVTX3_NAMESPACE_FOR

#define NVTX3_NAMESPACE_FOR (   VERSION)    NVTX3_CONCAT(v, VERSION)

Definition at line 586 of file nvtx3.hpp.

◆ NVTX3_STATIC_ASSERT

#define NVTX3_STATIC_ASSERT (   condition,
  message 
)    static_assert(condition, message);

Definition at line 620 of file nvtx3.hpp.

◆ NVTX3_STATIC_ASSERT_DEFINED_HERE

#define NVTX3_STATIC_ASSERT_DEFINED_HERE

Definition at line 621 of file nvtx3.hpp.

◆ NVTX3_USE_CHECKED_OVERLOADS_FOR_GET

#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET   1

Definition at line 578 of file nvtx3.hpp.

◆ NVTX3_USE_CHECKED_OVERLOADS_FOR_GET_DEFINED_HERE

#define NVTX3_USE_CHECKED_OVERLOADS_FOR_GET_DEFINED_HERE

Definition at line 580 of file nvtx3.hpp.

◆ NVTX3_V1_FUNC_RANGE

#define NVTX3_V1_FUNC_RANGE ( )    NVTX3_V1_FUNC_RANGE_IN(::nvtx3::v1::domain::global)

Convenience macro for generating a range in the global domain from the lifetime of a function.

This macro is useful for generating an NVTX range in the global domain from the entry point of a function to its exit. It is intended to be the first line of the function.

Constructs a static registered_string_in using the name of the immediately enclosing function returned by __func__ and constructs a nvtx3::scoped_range using the registered function name as the range's message.

Example:

void foo(...) {
NVTX3_FUNC_RANGE(); // Range begins on entry to foo()
// do stuff
...
} // Range ends on return from foo()

Definition at line 2809 of file nvtx3.hpp.

◆ NVTX3_V1_FUNC_RANGE_IF

#define NVTX3_V1_FUNC_RANGE_IF (   C)    NVTX3_V1_FUNC_RANGE_IF_IN(::nvtx3::v1::domain::global, C)

Convenience macro for generating a range in the global domain from the lifetime of a function if the given boolean expression evaluates to true.

Similar to NVTX3_V1_FUNC_RANGE(), the only difference being that NVTX3_V1_FUNC_RANGE_IF(C) only generates a range if the given boolean expression evaluates to true.

Parameters
[in]CBoolean expression used to determine if a range should be generated.

Definition at line 2822 of file nvtx3.hpp.

◆ NVTX3_V1_FUNC_RANGE_IF_IN

#define NVTX3_V1_FUNC_RANGE_IF_IN (   D,
 
)
Value:
::nvtx3::v1::detail::optional_scoped_range_in<D> optional_nvtx3_range__; \
if (C) { \
static ::nvtx3::v1::registered_string_in<D> const nvtx3_func_name__{__func__}; \
static ::nvtx3::v1::event_attributes const nvtx3_func_attr__{nvtx3_func_name__}; \
optional_nvtx3_range__.begin(nvtx3_func_attr__); \
}

Convenience macro for generating a range in the specified domain from the lifetime of a function if the given boolean expression evaluates to true.

Similar to NVTX3_V1_FUNC_RANGE_IN(D), the only difference being that NVTX3_V1_FUNC_RANGE_IF_IN(D, C) only generates a range if the given boolean expression evaluates to true.

Parameters
[in]DType containing name member used to identify the domain to which the registered_string_in belongs. Else, domain::global to indicate that the global NVTX domain should be used.
[in]CBoolean expression used to determine if a range should be generated.

Definition at line 2775 of file nvtx3.hpp.

◆ NVTX3_V1_FUNC_RANGE_IN

#define NVTX3_V1_FUNC_RANGE_IN (   D)
Value:
static ::nvtx3::v1::registered_string_in<D> const nvtx3_func_name__{__func__}; \
static ::nvtx3::v1::event_attributes const nvtx3_func_attr__{nvtx3_func_name__}; \
::nvtx3::v1::scoped_range_in<D> const nvtx3_range__{nvtx3_func_attr__};
A RAII object for creating a NVTX range local to a thread within a domain.
Definition: nvtx3.hpp:2060

Convenience macro for generating a range in the specified domain from the lifetime of a function.

This macro is useful for generating an NVTX range in domain from the entry point of a function to its exit. It is intended to be the first line of the function.

Constructs a static registered_string_in using the name of the immediately enclosing function returned by __func__ and constructs a nvtx3::scoped_range using the registered function name as the range's message.

Example:

struct my_domain{static constexpr char const* name{"my_domain"};};
void foo(...) {
NVTX3_FUNC_RANGE_IN(my_domain); // Range begins on entry to foo()
// do stuff
...
} // Range ends on return from foo()
Parameters
[in]DType containing name member used to identify the domain to which the registered_string_in belongs. Else, domain::global to indicate that the global NVTX domain should be used.

Definition at line 2754 of file nvtx3.hpp.

◆ NVTX3_VERSION_NAMESPACE

#define NVTX3_VERSION_NAMESPACE   NVTX3_NAMESPACE_FOR(NVTX3_CPP_VERSION_MAJOR)

Definition at line 587 of file nvtx3.hpp.

Typedef Documentation

◆ is_uint32

template<typename T >
using nvtx3::v1::detail::is_uint32 = typedef std::is_same<typename std::decay<T>::type, uint32_t>

Definition at line 671 of file nvtx3.hpp.

◆ named_category

using nvtx3::v1::named_category = typedef named_category_in<domain::global>

Alias for a named_category_in in the global NVTX domain.

Definition at line 1359 of file nvtx3.hpp.

◆ registered_string

using nvtx3::v1::registered_string = typedef registered_string_in<domain::global>

Alias for a registered_string_in in the global NVTX domain.

Definition at line 1584 of file nvtx3.hpp.

◆ scoped_range

using nvtx3::v1::scoped_range = typedef scoped_range_in<domain::global>

Alias for a scoped_range_in in the global NVTX domain.

Definition at line 2146 of file nvtx3.hpp.

◆ unique_range

using nvtx3::v1::unique_range = typedef unique_range_in<domain::global>

Alias for a unique_range_in in the global NVTX domain.

Definition at line 2592 of file nvtx3.hpp.

Function Documentation

◆ domain::get< domain::global >()

template<>
domain const & nvtx3::v1::domain::get< domain::global > ( )
inlinenoexcept

Returns reference to the domain object that represents the global NVTX domain.

This specialization for domain::global returns a default constructed, domain object for use when the "global" domain is desired.

All NVTX events in the global domain across all libraries and applications will be grouped together.

Returns
Reference to the domain corresponding to the global NVTX domain.

Definition at line 941 of file nvtx3.hpp.

◆ end_range()

void nvtx3::v1::end_range ( range_handle  r)
inlinenoexcept

Manually end the range associated with the handle r in the global domain.

Explicitly ends the NVTX range indicated by the handle r returned from a prior call to start_range. The range may end on a different thread from where it began.

Parameters
rHandle to a range started by a prior call to start_range.
Warning
The domain type specified as template parameter to this function must be the same that was specified on the associated start_range call.

Definition at line 2464 of file nvtx3.hpp.

◆ end_range_in()

template<typename D = domain::global>
void nvtx3::v1::end_range_in ( range_handle  r)
inlinenoexcept

Manually end the range associated with the handle r in domain D.

Explicitly ends the NVTX range indicated by the handle r returned from a prior call to start_range_in<D>. The range may end on a different thread from where it began.

Template Parameters
DType containing name member used to identify the domain to which the range belongs. Else, domain::global to indicate that the global NVTX domain should be used.
Parameters
rHandle to a range started by a prior call to start_range_in.
Warning
The domain type specified as template parameter to this function must be the same that was specified on the associated start_range_in call.

Definition at line 2442 of file nvtx3.hpp.

◆ mark() [1/2]

template<typename... Args>
void nvtx3::v1::mark ( Args const &...  args)
inlinenoexcept

Annotates an instantaneous point in time with a "marker", using the arguments to construct an event_attributes, in the global domain.

Unlike a "range" which has a beginning and an end, a marker is a single event in an application, such as detecting a problem:

bool success = do_operation(...);
if (!success) {
nvtx3::mark("operation failed!", nvtx3::rgb{255,0,0});
}
Indicates the values of the red, green, and blue color channels for an RGB color to use as an event a...
Definition: nvtx3.hpp:952

Note that nvtx3::mark is a function, not a class like scoped_range.

Forwards the arguments args... to construct an event_attributes object. The attributes are then associated with the marker. For more detail, see the event_attributes documentation.

Parameters
[in]argsVariadic parameter pack of arguments to construct an event_attributes associated with this range.

Definition at line 2714 of file nvtx3.hpp.

◆ mark() [2/2]

void nvtx3::v1::mark ( event_attributes const &  attr)
inlinenoexcept

Annotates an instantaneous point in time with a "marker", using the attributes specified by attr, in the global domain.

Unlike a "range" which has a beginning and an end, a marker is a single event in an application, such as detecting a problem:

bool success = do_operation(...);
if (!success) {
nvtx3::event_attributes attr{"operation failed!", nvtx3::rgb{255,0,0}};
nvtx3::mark(attr);
}
Describes the attributes of a NVTX event.
Definition: nvtx3.hpp:1913
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:2682

Note that nvtx3::mark is a function, not a class like scoped_range.

Parameters
[in]attrevent_attributes that describes the desired attributes of the mark.

Definition at line 2682 of file nvtx3.hpp.

◆ mark_in() [1/2]

template<typename D = domain::global, typename... Args>
void nvtx3::v1::mark_in ( Args const &...  args)
inlinenoexcept

Annotates an instantaneous point in time with a "marker", using the arguments to construct an event_attributes.

Unlike a "range" which has a beginning and an end, a marker is a single event in an application, such as detecting a problem:

bool success = do_operation(...);
if (!success) {
nvtx3::mark_in<my_domain>("operation failed!", nvtx3::rgb{255,0,0});
}

Note that nvtx3::mark_in<D> is a function, not a class like scoped_range_in<D>.

Forwards the arguments args... to construct an event_attributes object. The attributes are then associated with the marker. For more detail, see the event_attributes documentation.

Template Parameters
DType containing name member used to identify the domain to which the unique_range_in belongs. Else domain::global to indicate that the global NVTX domain should be used.
Parameters
[in]argsVariadic parameter pack of arguments to construct an event_attributes associated with this range.

Definition at line 2655 of file nvtx3.hpp.

◆ mark_in() [2/2]

template<typename D = domain::global>
void nvtx3::v1::mark_in ( event_attributes const &  attr)
inlinenoexcept

Annotates an instantaneous point in time with a "marker", using the attributes specified by attr.

Unlike a "range" which has a beginning and an end, a marker is a single event in an application, such as detecting a problem:

bool success = do_operation(...);
if (!success) {
nvtx3::event_attributes attr{"operation failed!", nvtx3::rgb{255,0,0}};
nvtx3::mark_in<my_domain>(attr);
}

Note that nvtx3::mark_in<D> is a function, not a class like scoped_range_in<D>.

Template Parameters
DType containing name member used to identify the domain to which the unique_range_in belongs. Else, domain::global to indicate that the global NVTX domain should be used.
Parameters
[in]attrevent_attributes that describes the desired attributes of the mark.

Definition at line 2618 of file nvtx3.hpp.

◆ operator!=()

constexpr bool nvtx3::v1::operator!= ( range_handle  lhs,
range_handle  rhs 
)
inlineconstexprnoexcept

Compares two range_handles for inequality.

Parameters
lhsThe first range_handle to compare
rhsThe second range_handle to compare

Definition at line 2271 of file nvtx3.hpp.

◆ operator==()

constexpr bool nvtx3::v1::operator== ( range_handle  lhs,
range_handle  rhs 
)
inlineconstexprnoexcept

Compares two range_handles for equality.

Parameters
lhsThe first range_handle to compare
rhsThe second range_handle to compare

Definition at line 2260 of file nvtx3.hpp.

◆ start_range() [1/2]

template<typename... Args>
range_handle nvtx3::v1::start_range ( Args const &...  args)
inlinenoexcept

Manually begin an NVTX range in the global domain.

Explicitly begins an NVTX range and returns a unique handle. To end the range, pass the handle to end_range_in<D>().

nvtx3::start_range(...) is equivalent to nvtx3::start_range_in<>(...) and nvtx3::start_range_in<nvtx3::domain::global>(...).

start_range_in/end_range_in are the most explicit and lowest level APIs provided for creating ranges. Use of nvtx3::unique_range_in should be preferred unless one is unable to tie the range to the lifetime of an object.

This overload uses args... to construct an event_attributes to associate with the range. For more detail, see event_attributes.

Example:

// Manually begin a range
nvtx3::range_handle h = nvtx3::start_range("msg", nvtx3::rgb{127,255,0});
...
nvtx3::end_range(h); // Ends the range
Handle used for correlating explicit range start and end events.
Definition: nvtx3.hpp:2199
Parameters
args[in]Variadic parameter pack of the arguments for an event_attributes.
Returns
Unique handle to be passed to end_range to end the range.

Definition at line 2417 of file nvtx3.hpp.

◆ start_range() [2/2]

range_handle nvtx3::v1::start_range ( event_attributes const &  attr)
inlinenoexcept

Manually begin an NVTX range in the global domain.

Explicitly begins an NVTX range and returns a unique handle. To end the range, pass the handle to end_range().

nvtx3::start_range(...) is equivalent to nvtx3::start_range_in<>(...) and nvtx3::start_range_in<nvtx3::domain::global>(...).

start_range/end_range are the most explicit and lowest level APIs provided for creating ranges. Use of nvtx3::unique_range should be preferred unless one is unable to tie the range to the lifetime of an object.

Example:

nvtx3::event_attributes attr{"msg", nvtx3::rgb{127,255,0}};
// Manually begin a range
...
nvtx3::end_range(h); // End the range
range_handle start_range(event_attributes const &attr) noexcept
Manually begin an NVTX range in the global domain.
Definition: nvtx3.hpp:2379
Parameters
[in]attrevent_attributes that describes the desired attributes of the range.
Returns
Unique handle to be passed to end_range_in to end the range.

Definition at line 2379 of file nvtx3.hpp.

◆ start_range_in() [1/2]

template<typename D = domain::global, typename... Args>
range_handle nvtx3::v1::start_range_in ( Args const &...  args)
inlinenoexcept

Manually begin an NVTX range.

Explicitly begins an NVTX range and returns a unique handle. To end the range, pass the handle to end_range_in<D>().

nvtx3::start_range(...) is equivalent to nvtx3::start_range_in<>(...) and nvtx3::start_range_in<nvtx3::domain::global>(...).

start_range_in/end_range_in are the most explicit and lowest level APIs provided for creating ranges. Use of nvtx3::unique_range_in should be preferred unless one is unable to tie the range to the lifetime of an object.

This overload uses args... to construct an event_attributes to associate with the range. For more detail, see event_attributes.

Example:

// Manually begin a range
nvtx3::range_handle h = nvtx3::start_range_in<D>("msg", nvtx3::rgb{127,255,0});
...
nvtx3::end_range_in<D>(h); // Ends the range
Template Parameters
DType containing name member used to identify the domain to which the range belongs. Else, domain::global to indicate that the global NVTX domain should be used.
Parameters
args[in]Variadic parameter pack of the arguments for an event_attributes.
Returns
Unique handle to be passed to end_range to end the range.

Definition at line 2344 of file nvtx3.hpp.

◆ start_range_in() [2/2]

template<typename D = domain::global>
range_handle nvtx3::v1::start_range_in ( event_attributes const &  attr)
inlinenoexcept

Manually begin an NVTX range.

Explicitly begins an NVTX range and returns a unique handle. To end the range, pass the handle to end_range_in<D>().

nvtx3::start_range(...) is equivalent to nvtx3::start_range_in<>(...) and nvtx3::start_range_in<nvtx3::domain::global>(...).

start_range_in/end_range_in are the most explicit and lowest level APIs provided for creating ranges. Use of nvtx3::unique_range_in should be preferred unless one is unable to tie the range to the lifetime of an object.

Example:

nvtx3::event_attributes attr{"msg", nvtx3::rgb{127,255,0}};
// Manually begin a range
nvtx3::range_handle h = nvtx3::start_range_in<my_domain>(attr);
...
nvtx3::end_range_in<my_domain>(h); // End the range
Template Parameters
DType containing name member used to identify the domain to which the range belongs. Else, domain::global to indicate that the global NVTX domain should be used.
Parameters
[in]attrevent_attributes that describes the desired attributes of the range.
Returns
Unique handle to be passed to end_range_in to end the range.

Definition at line 2303 of file nvtx3.hpp.