Provides C++ constructs making the NVTX library safer and easier to use with zero overhead.
More...
|
| #define | NVTX3_CPP_VERSION_MAJOR 1 |
| |
| #define | NVTX3_CPP_VERSION_MINOR 2 |
| |
| #define | NVTX3_INLINE_THIS_VERSION |
| |
| #define | NVTX3_CPP_INLINED_VERSION_MAJOR 1 |
| | Semantic major version number for NVTX C++ wrappers of unversioned symbols.
|
| |
| #define | NVTX3_CPP_INLINED_VERSION_MINOR 2 |
| | Semantic minor version number for NVTX C++ wrappers of unversioned symbols.
|
| |
| #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_MINOR_NAMESPACE_FOR(VERSION) NVTX3_CONCAT(mv, VERSION) |
| |
| #define | NVTX3_MINOR_VERSION_NAMESPACE NVTX3_MINOR_NAMESPACE_FOR(NVTX3_CPP_VERSION_MINOR) |
| |
| #define | NVTX3_INLINE_IF_REQUESTED inline |
| |
| #define | NVTX3_CONSTEXPR_IF_CPP14 |
| |
| #define | NVTX3_CONSTEXPR_IF_CPP20 |
| |
| #define | __has_cpp_attribute(x) 0 |
| |
| #define | NVTX3_MAYBE_UNUSED |
| |
| #define | NVTX3_NO_DISCARD |
| |
| #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.
|
| |
| #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.
|
| |
| #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.
|
| |
| #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.
|
| |
| #define | NVTX3_V1_NO_DISCARD |
| |
| #define | NVTX3_V1_DEFINE_SCHEMA_GET(dom, struct_id, schema_name, entries) |
| | Convenience macro for generating a sspecialization of nvtx3::schema::get for an existing struct.
|
| |
| #define | NVTX3_V1_SEMANTIC(expr) |
| | Macro for inline semantic definitions in schema entries.
|
| |
| #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 |
| |
| #define | NVTX3_DEFINE_SCHEMA_GET NVTX3_V1_DEFINE_SCHEMA_GET |
| |
| #define | NVTX3_SEMANTIC NVTX3_V1_SEMANTIC |
| |
|
| template<> |
| domain const & | nvtx3::v1::domain::get< domain::global > () noexcept |
| | Returns reference to the domain object that represents the global NVTX domain.
|
| |
| template<typename D = domain::global> |
| int | nvtx3::v1::push_range_in (event_attributes const &attr) noexcept |
| | Manually begin a nested thread range in a domain.
|
| |
| template<typename D = domain::global, typename... Args> |
| int | nvtx3::v1::push_range_in (Args const &... args) noexcept |
| | Manually begin a nested thread range in a domain.
|
| |
| int | nvtx3::v1::push_range (event_attributes const &attr) noexcept |
| | Manually begin a nested thread range in the global domain.
|
| |
| template<typename... Args> |
| int | nvtx3::v1::push_range (Args const &... args) noexcept |
| | Manually begin a nested thread range in the global domain.
|
| |
| template<typename D = domain::global> |
| int | nvtx3::v1::pop_range_in () noexcept |
| | Manually end the current nested thread range in a domain.
|
| |
| int | nvtx3::v1::pop_range () noexcept |
| | Manually end the current nested thread range in the global domain.
|
| |
| constexpr bool | nvtx3::v1::operator== (range_handle lhs, range_handle rhs) noexcept |
| | Compares two range_handles for equality.
|
| |
| constexpr bool | nvtx3::v1::operator!= (range_handle lhs, range_handle rhs) noexcept |
| | Compares two range_handles for inequality.
|
| |
| template<typename D = domain::global> |
| range_handle | nvtx3::v1::start_range_in (event_attributes const &attr) noexcept |
| | Manually begin an NVTX range.
|
| |
| template<typename D = domain::global, typename... Args> |
| range_handle | nvtx3::v1::start_range_in (Args const &... args) noexcept |
| | Manually begin an NVTX range.
|
| |
| range_handle | nvtx3::v1::start_range (event_attributes const &attr) noexcept |
| | Manually begin an NVTX range in the global domain.
|
| |
| template<typename... Args> |
| range_handle | nvtx3::v1::start_range (Args const &... args) noexcept |
| | Manually begin an NVTX range in the global domain.
|
| |
| template<typename D = domain::global> |
| void | nvtx3::v1::end_range_in (range_handle r) noexcept |
| | Manually end the range associated with the handle r in domain D.
|
| |
| void | nvtx3::v1::end_range (range_handle r) noexcept |
| | Manually end the range associated with the handle r in the global domain.
|
| |
| template<typename D = domain::global> |
| void | nvtx3::v1::mark_in (event_attributes const &attr) noexcept |
| | Annotates an instantaneous point in time with a "marker", using the attributes specified by attr.
|
| |
| template<typename D = domain::global, typename... Args> |
| void | nvtx3::v1::mark_in (Args const &... args) noexcept |
| | Annotates an instantaneous point in time with a "marker", using the arguments to construct an event_attributes.
|
| |
| void | nvtx3::v1::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.
|
| |
| template<typename... Args> |
| void | nvtx3::v1::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.
|
| |
| int64_t | nvtx3::v1::timestamp () noexcept |
| | Read a timestamp from the NVTX handler (wraps nvtxTimestampGet).
|
| |
Provides C++ constructs making the NVTX library safer and easier to use with zero overhead.
Definition in file nvtx3.hpp.
| #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 110 of file nvtx3.hpp.
| #define NVTX3_CPP_INLINED_VERSION_MINOR 2 |
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 122 of file nvtx3.hpp.
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();
...
}
Definition at line 4841 of file nvtx3.hpp.
| #define NVTX3_V1_SEMANTIC |
( |
|
expr | ) |
|
Value: ([]() -> nvtxSemanticsHeader_t const* { \
static auto const s_ = (expr); \
return s_.get(); \
}())
Macro for inline semantic definitions in schema entries.
Use this macro within NVTX_PAYLOAD_ENTRIES to attach per-field semantics or a chain thereof. The macro creates a static local to give the semantic object stable storage for the lifetime of the program, and returns the pointer to its header that the schema entry's semantics field expects.
The type of the semantic is deduced from the expression, so any builder in the nvtx3::v1 semantic family works. If the semantic is chained to another semantic, the chain is copied into the static semantic object.
Example:
NVTX3_DEFINE_SCHEMA_GET(
my_domain,
sensor_data,
"SensorData",
NVTX_PAYLOAD_ENTRIES(
(temperature, TYPE_FLOAT, "Temperature", nullptr, 0, UNUSED,
(pressure, TYPE_FLOAT, "Pressure", nullptr, 0, UNUSED,
Builder class for configuring counter semantics.
counter_semantic & unit(const char *unit_name) noexcept
Set the unit string for the counter (e.g., "bytes", "ms", "%").
- Parameters
-
| expr | Any semantic builder expression exposing a get() method returning an nvtxSemanticsHeader_t const*. |
Definition at line 4944 of file nvtx3.hpp.
template<typename... Args>
| void nvtx3::v1::mv2::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...
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] | args | Variadic parameter pack of arguments to construct an event_attributes associated with this range. |
Definition at line 3506 of file nvtx3.hpp.
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) {
}
Describes the attributes of a NVTX event.
void mark(event_attributes const &attr) noexcept
Annotates an instantaneous point in time with a "marker", using the attributes specified by attr,...
Note that nvtx3::mark is a function, not a class like scoped_range.
- Parameters
-
| [in] | attr | event_attributes that describes the desired attributes of the mark. |
Definition at line 3472 of file nvtx3.hpp.
template<typename D = domain::global, typename... Args>
| void nvtx3::v1::mv2::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
-
| D | Type 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] | args | Variadic parameter pack of arguments to construct an event_attributes associated with this range. |
Definition at line 3443 of file nvtx3.hpp.
template<typename D = domain::global>
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::mark_in<my_domain>(attr);
}
Note that nvtx3::mark_in<D> is a function, not a class like scoped_range_in<D>.
- Template Parameters
-
| D | Type 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] | attr | event_attributes that describes the desired attributes of the mark. |
Definition at line 3406 of file nvtx3.hpp.
| int nvtx3::v1::mv2::pop_range |
( |
| ) |
|
|
inlinenoexcept |
Manually end the current nested thread range in the global domain.
This function is equivalent to nvtx3::pop_range_in<>() and nvtx3::pop_range_in<nvtx3::domain::global>().
Prefer nvtx3::scoped_range when a range can be tied to a C++ object lifetime. Use this manual push/pop API for callback-driven code or other control flows where the range begin and end happen in separate C++ scopes.
- Warning
- Manual push/pop ranges are not RAII protected. The caller is responsible for ensuring each pushed range has exactly one matching pop, ranges are properly nested, and the matching pop is called on the same thread.
- Returns
- The level of the range being ended, or a negative value if an error occurs.
Definition at line 2923 of file nvtx3.hpp.
template<typename D = domain::global>
| int nvtx3::v1::mv2::pop_range_in |
( |
| ) |
|
|
inlinenoexcept |
Manually end the current nested thread range in a domain.
Ends the innermost range previously started by push_range_in<D>() on the same thread.
Prefer nvtx3::scoped_range_in when a range can be tied to a C++ object lifetime. Use this manual push/pop API for callback-driven code or other control flows where the range begin and end happen in separate C++ scopes.
- Warning
- Manual push/pop ranges are not RAII protected. The caller is responsible for ensuring each pushed range has exactly one matching pop, ranges are properly nested, and the matching pop is called on the same thread.
- Template Parameters
-
| D | Type 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. |
- Returns
- The level of the range being ended, or a negative value if an error occurs.
Definition at line 2896 of file nvtx3.hpp.
template<typename... Args>
| int nvtx3::v1::mv2::push_range |
( |
Args const &... |
args | ) |
|
|
inlinenoexcept |
Manually begin a nested thread range in the global domain.
This function is equivalent to nvtx3::push_range_in<>() and nvtx3::push_range_in<nvtx3::domain::global>().
This overload uses args... to construct an event_attributes object to associate with the range. For more detail, see event_attributes.
Prefer nvtx3::scoped_range when a range can be tied to a C++ object lifetime. Use this manual push/pop API for callback-driven code or other control flows where the range begin and end happen in separate C++ scopes.
- Warning
- Manual push/pop ranges are not RAII protected. The caller is responsible for ensuring each pushed range has exactly one matching pop, ranges are properly nested, and the matching pop is called on the same thread.
- Parameters
-
| [in] | args | Variadic parameter pack of the arguments for an event_attributes. |
- Returns
- The 0-based level of the range being started, or a negative value if an error occurs.
Definition at line 2864 of file nvtx3.hpp.
template<typename D = domain::global, typename... Args>
| int nvtx3::v1::mv2::push_range_in |
( |
Args const &... |
args | ) |
|
|
inlinenoexcept |
Manually begin a nested thread range in a domain.
This overload uses args... to construct an event_attributes object to associate with the range. For more detail, see event_attributes.
Prefer nvtx3::scoped_range_in when a range can be tied to a C++ object lifetime. Use this manual push/pop API for callback-driven code or other control flows where the range begin and end happen in separate C++ scopes.
- Warning
- Manual push/pop ranges are not RAII protected. The caller is responsible for ensuring each pushed range has exactly one matching pop, ranges are properly nested, and the matching pop is called on the same thread.
Example:
nvtx3::push_range_in<my_domain>(
"msg",
nvtx3::rgb{127,255,0});
...
nvtx3::pop_range_in<my_domain>();
- Template Parameters
-
| D | Type 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] | args | Variadic parameter pack of the arguments for an event_attributes. |
- Returns
- The 0-based level of the range being started, or a negative value if an error occurs.
Definition at line 2801 of file nvtx3.hpp.
template<typename D = domain::global>
Manually begin a nested thread range in a domain.
This function begins a nested range on the calling thread in the specified domain. End the range with a matching call to pop_range_in<D>() on the same thread.
Prefer nvtx3::scoped_range_in when a range can be tied to a C++ object lifetime. Use this manual push/pop API for callback-driven code or other control flows where the range begin and end happen in separate C++ scopes.
- Warning
- Manual push/pop ranges are not RAII protected. The caller is responsible for ensuring each pushed range has exactly one matching pop, ranges are properly nested, and the matching pop is called on the same thread.
Example:
nvtx3::push_range_in<my_domain>(attr);
...
nvtx3::pop_range_in<my_domain>();
- Template Parameters
-
| D | Type 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] | attr | event_attributes that describes the desired attributes of the range. |
- Returns
- The 0-based level of the range being started, or a negative value if an error occurs.
Definition at line 2761 of file nvtx3.hpp.
template<typename... Args>
| range_handle nvtx3::v1::mv2::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:
...
nvtx3::end_range(h);
Handle used for correlating explicit range start and end events.
- Parameters
-
| [in] | args | 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 3204 of file nvtx3.hpp.
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::end_range(h);
range_handle start_range(event_attributes const &attr) noexcept
Manually begin an NVTX range in the global domain.
- Parameters
-
| [in] | attr | event_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 3166 of file nvtx3.hpp.
template<typename D = domain::global, typename... Args>
| range_handle nvtx3::v1::mv2::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:
...
nvtx3::end_range_in<D>(h);
- Template Parameters
-
| D | Type 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] | args | 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 3130 of file nvtx3.hpp.
template<typename D = domain::global>
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::end_range_in<my_domain>(h);
- Template Parameters
-
| D | Type 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] | attr | event_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 3089 of file nvtx3.hpp.