|
| | counter_in (const char *name, const char *description=nullptr, scope s=scope::none()) noexcept |
| | Construct a counter with a name, description, and scope.
|
| |
| | counter_in (std::string const &name, scope s=scope::none()) noexcept |
| | Construct a counter with a name and scope.
|
| |
| | counter_in (std::string const &name, std::string const &description, scope s=scope::none()) noexcept |
| | Construct a counter with a name, description, and scope.
|
| |
| | counter_in (const char *name, const char *description, scope s, const counter_semantic &semantic) noexcept |
| | Construct a counter with name, description, scope, and semantics.
|
| |
| | counter_in (std::string const &name, std::string const &description, scope s, const counter_semantic &semantic) noexcept |
| | Construct a counter with name, description, scope, and semantics.
|
| |
| void | sample (T const &value) noexcept |
| | Sample the counter with a value.
|
| |
| void | sample_no_value (no_value_reason reason) noexcept |
| | Sample the counter without a value.
|
| |
| void | submit_batch (T const *values, size_t count, uint64_t flags=0) noexcept |
| | Submit a batch of counter samples.
|
| |
| void | submit_batch (T const *values, size_t count, int64_t const *timestamps, size_t timestamp_count, uint64_t flags=0) noexcept |
| | Submit a batch of counter samples with external timestamps.
|
| |
| template<typename CounterContainer , typename = typename std::enable_if< detail::has_data_member<CounterContainer, T>::value && detail::has_size_member<CounterContainer>::value>::type> |
| void | submit_batch (CounterContainer const &values, uint64_t flags=0) noexcept |
| | Submit a batch from a contiguous container.
|
| |
| template<typename CounterContainer , typename TimestampContainer , typename = typename std::enable_if< detail::has_data_member<CounterContainer, T>::value && detail::has_size_member<CounterContainer>::value && detail::has_data_member<TimestampContainer, int64_t>::value && detail::has_size_member<TimestampContainer>::value>::type> |
| void | submit_batch (CounterContainer const &values, TimestampContainer const ×tamps, uint64_t flags=0) noexcept |
| | Submit a batch from contiguous sample and timestamp containers.
|
| |
| uint64_t | id () const noexcept |
| | Get the underlying counter ID.
|
| |
template<typename T, typename D = domain::global>
class nvtx3::v1::mv2::counter_in< T, D >
A type-safe NVTX counter in a specific domain.
counter_in provides a type-safe interface for NVTX counters. The counter value type is specified as a template parameter, ensuring that only values of the correct type can be sampled.
For primitive types (int64_t, double, etc.), the schema is automatically determined. For user-defined struct types, a schema must be registered using NVTX3_DEFINE_SCHEMA_GET.
- Template Parameters
-
| T | The value type of the counter. |
| D | The domain type (defaults to global domain). |
Example:
nvtx3::counter<int64_t> iterations{"iteration_count"};
iterations.sample(42);
sem.
unit(
"bytes").
limits(int64_t{0}, int64_t{1024 * 1024});
nvtx3::counter<int64_t> memory{"heap_size",
"Process heap size",
nvtx3::scope::current_sw_process(),
sem};
memory.sample(512 * 1024);
nvtx3::counter<gpu_metrics> gpu{"gpu_0"};
gpu.sample({72.5f, 250, 0.85});
Builder class for configuring counter semantics.
counter_semantic & limits(T min_val, T max_val) noexcept
Set minimum and maximum limits, typed.
counter_semantic & unit(const char *unit_name) noexcept
Set the unit string for the counter (e.g., "bytes", "ms", "%").
Definition at line 4498 of file nvtx3.hpp.
template<typename T , typename D = domain::global>
Sample the counter with a value.
The value type must match the counter's template parameter T. For primitive types (int64_t, double), optimized sampling functions are used. For struct types, the value is passed by reference.
- Parameters
-
| value | The counter value to sample. |
Definition at line 4577 of file nvtx3.hpp.
template<typename T , typename D = domain::global>
template<typename CounterContainer , typename TimestampContainer , typename = typename std::enable_if< detail::has_data_member<CounterContainer, T>::value && detail::has_size_member<CounterContainer>::value && detail::has_data_member<TimestampContainer, int64_t>::value && detail::has_size_member<TimestampContainer>::value>::type>
| void nvtx3::v1::mv2::counter_in< T, D >::submit_batch |
( |
CounterContainer const & |
values, |
|
|
TimestampContainer const & |
timestamps, |
|
|
uint64_t |
flags = 0 |
|
) |
| |
|
inlinenoexcept |
Submit a batch from contiguous sample and timestamp containers.
The sample container must expose T elements. The timestamp container must expose int64_t elements.
Definition at line 4684 of file nvtx3.hpp.
template<typename T , typename D = domain::global>
template<typename CounterContainer , typename = typename std::enable_if< detail::has_data_member<CounterContainer, T>::value && detail::has_size_member<CounterContainer>::value>::type>
Submit a batch from a contiguous container.
The container must expose data() returning T* or T const*, and size() convertible to size_t.
Definition at line 4664 of file nvtx3.hpp.