NVTX C++ API Reference 1.0
C++ convenience wrappers for NVTX v3 C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
nvtx3::v1::scoped_range_in< D > Class Template Reference

A RAII object for creating a NVTX range local to a thread within a domain. More...

#include <nvtx3.hpp>

Public Member Functions

 scoped_range_in (event_attributes const &attr) noexcept
 Construct a scoped_range_in with the specified event_attributes More...
 
template<typename... Args>
 scoped_range_in (Args const &... args) noexcept
 Constructs a scoped_range_in from the constructor arguments of an event_attributes. More...
 
 scoped_range_in () noexcept
 Default constructor creates a scoped_range_in with no message, color, payload, nor category. More...
 
void * operator new (std::size_t)=delete
 Delete operator new to disallow heap allocated objects. More...
 
 scoped_range_in (scoped_range_in const &)=delete
 
scoped_range_inoperator= (scoped_range_in const &)=delete
 
 scoped_range_in (scoped_range_in &&)=delete
 
scoped_range_inoperator= (scoped_range_in &&)=delete
 
 ~scoped_range_in () noexcept
 Destroy the scoped_range_in, ending the NVTX range event. More...
 

Detailed Description

template<class D = domain::global>
class nvtx3::v1::scoped_range_in< D >

A RAII object for creating a NVTX range local to a thread within a domain.

When constructed, begins a nested NVTX range on the calling thread in the specified domain. Upon destruction, ends the NVTX range.

Behavior is undefined if a scoped_range_in object is created/destroyed on different threads.

scoped_range_in is neither moveable nor copyable.

scoped_range_ins may be nested within other ranges.

The domain of the range is specified by the template type parameter D. By default, the domain::global is used, which scopes the range to the global NVTX domain. The convenience alias scoped_range is provided for ranges scoped to the global domain.

A custom domain can be defined by creating a type, D, with a static member D::name whose value is used to name the domain associated with D. D::name must resolve to either char const* or wchar_t const*

Example:

// Define a type `my_domain` with a member `name` used to name the domain
// associated with the type `my_domain`.
struct my_domain{
static constexpr char const* name{"my domain"};
};

Usage:

nvtx3::scoped_range_in<my_domain> r1{"range 1"}; // Range in my domain
// Three equivalent ways to make a range in the global domain:
nvtx3::scoped_range r4{"range 4"};
// Create an alias to succinctly make ranges in my domain:
using my_scoped_range = nvtx3::scoped_range_in<my_domain>;
my_scoped_range r3{"range 3"};
A RAII object for creating a NVTX range local to a thread within a domain.
Definition: nvtx3.hpp:2060

Definition at line 2060 of file nvtx3.hpp.

Constructor & Destructor Documentation

◆ scoped_range_in() [1/3]

template<class D = domain::global>
nvtx3::v1::scoped_range_in< D >::scoped_range_in ( event_attributes const &  attr)
inlineexplicitnoexcept

Construct a scoped_range_in with the specified event_attributes

Example:

nvtx3::event_attributes attr{"msg", nvtx3::rgb{127,255,0}};
nvtx3::scoped_range range{attr}; // Creates a range with message contents
// "msg" and green color
Describes the attributes of a NVTX event.
Definition: nvtx3.hpp:1913
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
Parameters
[in]attrevent_attributes that describes the desired attributes of the range.

Definition at line 2076 of file nvtx3.hpp.

◆ scoped_range_in() [2/3]

template<class D = domain::global>
template<typename... Args>
nvtx3::v1::scoped_range_in< D >::scoped_range_in ( Args const &...  args)
inlineexplicitnoexcept

Constructs a scoped_range_in from the constructor arguments of an event_attributes.

Forwards the arguments args... to construct an event_attributes object. The event_attributes object is then associated with the scoped_range_in.

For more detail, see event_attributes documentation.

Example:

// Creates a range with message "message" and green color
nvtx3::scoped_range r{"message", nvtx3::rgb{127,255,0}};
scoped_range_in< domain::global > scoped_range
Alias for a scoped_range_in in the global NVTX domain.
Definition: nvtx3.hpp:2146
Parameters
[in]argsArguments to used to construct an event_attributes associated with this range.

Definition at line 2106 of file nvtx3.hpp.

◆ scoped_range_in() [3/3]

template<class D = domain::global>
nvtx3::v1::scoped_range_in< D >::scoped_range_in ( )
inlinenoexcept

Default constructor creates a scoped_range_in with no message, color, payload, nor category.

Definition at line 2116 of file nvtx3.hpp.

◆ ~scoped_range_in()

template<class D = domain::global>
nvtx3::v1::scoped_range_in< D >::~scoped_range_in ( )
inlinenoexcept

Destroy the scoped_range_in, ending the NVTX range event.

Definition at line 2134 of file nvtx3.hpp.

Member Function Documentation

◆ operator new()

template<class D = domain::global>
void * nvtx3::v1::scoped_range_in< D >::operator new ( std::size_t  )
delete

Delete operator new to disallow heap allocated objects.

scoped_range_in must follow RAII semantics to guarantee proper push/pop semantics.


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