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::mv2::counter_semantic Class Reference

Builder class for configuring counter semantics. More...

#include <nvtx3.hpp>

Inheritance diagram for nvtx3::v1::mv2::counter_semantic:
Inheritance graph
[legend]
Collaboration diagram for nvtx3::v1::mv2::counter_semantic:
Collaboration graph
[legend]

Public Member Functions

 counter_semantic () noexcept
 Construct an unchained counter semantic.
 
 counter_semantic (nvtxSemanticsHeader_t const *next)
 Construct a counter semantic chained to another semantic header.
 
template<typename OtherDataType >
 counter_semantic (detail::semantic_base< OtherDataType > const &next)
 Construct a counter semantic that chains to another semantic builder.
 
counter_semanticunit (const char *unit_name) noexcept
 Set the unit string for the counter (e.g., "bytes", "ms", "%").
 
counter_semanticunit (std::string const &unit_name) noexcept
 Set the unit string for the counter (e.g., "bytes", "ms", "%").
 
counter_semanticunit (std::string &&unit_name)=delete
 Disallow setting the borrowed unit string from a temporary string.
 
counter_semanticunit_scale (uint64_t numerator, uint64_t denominator=1) noexcept
 Set the unit scale as a fraction (numerator/denominator).
 
counter_semanticnormalize () noexcept
 Enable normalization of counter values.
 
counter_semanticvaluetype_absolute ()
 Set value type to absolute.
 
counter_semanticvaluetype_delta ()
 Set value type to delta from previous sample.
 
counter_semanticvaluetype_delta_since_start ()
 Set value type to delta since start.
 
counter_semanticinterpolation_point ()
 Set interpolation to point (no interpolation between samples).
 
counter_semanticinterpolation_since_last ()
 Set interpolation to piecewise constant from last sample.
 
counter_semanticinterpolation_until_next ()
 Set interpolation to piecewise constant until next sample.
 
counter_semanticinterpolation_linear ()
 Set interpolation to linear between samples.
 
template<typename T >
counter_semanticlimits (T min_val, T max_val) noexcept
 Set minimum and maximum limits, typed.
 
template<typename T >
counter_semanticlimit_min (T min_val) noexcept
 Set only the minimum limit, typed.
 
template<typename T >
counter_semanticlimit_max (T max_val) noexcept
 Set only the maximum limit, typed.
 

Detailed Description

Builder class for configuring counter semantics.

Counter semantics provide additional metadata about counter values, such as units, limits, interpolation behavior, and value types. This information helps tools to properly display and interpret counter data.

Settings are always accumulated as flags, never reset. Do not mix overlapping settings.

Setters return *this to allow method chaining.

Example:

sem.unit("bytes")
.limits<int64_t>(0, 1024LL * 1024 * 1024)
nvtx3::counter<int64_t> memory{"heap_size",
"Process heap size",
nvtx3::scope::current_sw_process(),
sem};
Builder class for configuring counter semantics.
Definition nvtx3.hpp:3641
counter_semantic & limits(T min_val, T max_val) noexcept
Set minimum and maximum limits, typed.
Definition nvtx3.hpp:3859
counter_semantic & unit(const char *unit_name) noexcept
Set the unit string for the counter (e.g., "bytes", "ms", "%").
Definition nvtx3.hpp:3694
counter_semantic & interpolation_since_last()
Set interpolation to piecewise constant from last sample.
Definition nvtx3.hpp:3807

Definition at line 3641 of file nvtx3.hpp.

Constructor & Destructor Documentation

◆ counter_semantic() [1/3]

nvtx3::v1::mv2::counter_semantic::counter_semantic ( )
inlinenoexcept

Construct an unchained counter semantic.

Definition at line 3646 of file nvtx3.hpp.

◆ counter_semantic() [2/3]

nvtx3::v1::mv2::counter_semantic::counter_semantic ( nvtxSemanticsHeader_t const *  next)
inlineexplicit

Construct a counter semantic chained to another semantic header.

Parameters
nextNon-owning pointer to the next semantic in the chain (nullptr if none).

Definition at line 3666 of file nvtx3.hpp.

◆ counter_semantic() [3/3]

template<typename OtherDataType >
nvtx3::v1::mv2::counter_semantic::counter_semantic ( detail::semantic_base< OtherDataType > const &  next)
inlineexplicit

Construct a counter semantic that chains to another semantic builder.

Convenience overload of the header-pointer constructor that accepts a sibling semantic builder object directly. The referenced builder is copied into this object.

Template Parameters
OtherDataTypeUnderlying C struct type of the other semantic.
Parameters
nextThe semantic builder to chain after this one.

Definition at line 3683 of file nvtx3.hpp.

Member Function Documentation

◆ interpolation_linear()

counter_semantic & nvtx3::v1::mv2::counter_semantic::interpolation_linear ( )
inline

Set interpolation to linear between samples.

Exceptions
std::logic_errorif any interpolation_* setter has already been called on this object.
Returns
Reference to this object for chaining.

Definition at line 3835 of file nvtx3.hpp.

◆ interpolation_point()

counter_semantic & nvtx3::v1::mv2::counter_semantic::interpolation_point ( )
inline

Set interpolation to point (no interpolation between samples).

Exceptions
std::logic_errorif any interpolation_* setter has already been called on this object.
Returns
Reference to this object for chaining.

Definition at line 3793 of file nvtx3.hpp.

◆ interpolation_since_last()

counter_semantic & nvtx3::v1::mv2::counter_semantic::interpolation_since_last ( )
inline

Set interpolation to piecewise constant from last sample.

Exceptions
std::logic_errorif any interpolation_* setter has already been called on this object.
Returns
Reference to this object for chaining.

Definition at line 3807 of file nvtx3.hpp.

◆ interpolation_until_next()

counter_semantic & nvtx3::v1::mv2::counter_semantic::interpolation_until_next ( )
inline

Set interpolation to piecewise constant until next sample.

Exceptions
std::logic_errorif any interpolation_* setter has already been called on this object.
Returns
Reference to this object for chaining.

Definition at line 3821 of file nvtx3.hpp.

◆ limit_max()

template<typename T >
counter_semantic & nvtx3::v1::mv2::counter_semantic::limit_max ( max_val)
inlinenoexcept

Set only the maximum limit, typed.

Template Parameters
TOne of int64_t, uint64_t, or double.
Parameters
max_valMaximum limit.
Returns
Reference to this object for chaining.

Definition at line 3892 of file nvtx3.hpp.

◆ limit_min()

template<typename T >
counter_semantic & nvtx3::v1::mv2::counter_semantic::limit_min ( min_val)
inlinenoexcept

Set only the minimum limit, typed.

Template Parameters
TOne of int64_t, uint64_t, or double.
Parameters
min_valMinimum limit.
Returns
Reference to this object for chaining.

Definition at line 3876 of file nvtx3.hpp.

◆ limits()

template<typename T >
counter_semantic & nvtx3::v1::mv2::counter_semantic::limits ( min_val,
max_val 
)
inlinenoexcept

Set minimum and maximum limits, typed.

Template Parameters
TOne of int64_t, uint64_t, or double; selects the union member in the underlying nvtxSemanticsCounter_v1 struct and the corresponding NVTX_COUNTER_LIMIT_* tag stored in limitType.
Parameters
min_valMinimum limit.
max_valMaximum limit.
Returns
Reference to this object for chaining.
Note
If limit_min<T1>() and limit_max<T2>() are called with different T the last call wins on limitType, and the earlier write lives in the wrong union member. Prefer this overload of limits() over paired limit_min/limit_max when you want both bounds.

Definition at line 3859 of file nvtx3.hpp.

◆ normalize()

counter_semantic & nvtx3::v1::mv2::counter_semantic::normalize ( )
inlinenoexcept

Enable normalization of counter values.

Convert the fixed point value to a normalized floating point. Use the sign/unsign from the underlying type this flag is applied to. Unsigned [0f : 1f] or signed [-1f : 1f]

Returns
Reference to this object for chaining.

Definition at line 3738 of file nvtx3.hpp.

◆ unit() [1/2]

counter_semantic & nvtx3::v1::mv2::counter_semantic::unit ( const char *  unit_name)
inlinenoexcept

Set the unit string for the counter (e.g., "bytes", "ms", "%").

Parameters
unit_nameUnit string (must remain valid for the lifetime of this object).
Returns
Reference to this object for chaining.

Definition at line 3694 of file nvtx3.hpp.

◆ unit() [2/2]

counter_semantic & nvtx3::v1::mv2::counter_semantic::unit ( std::string const &  unit_name)
inlinenoexcept

Set the unit string for the counter (e.g., "bytes", "ms", "%").

Parameters
unit_nameUnit string (must remain valid for the lifetime of this object).
Returns
Reference to this object for chaining.

Definition at line 3705 of file nvtx3.hpp.

◆ unit_scale()

counter_semantic & nvtx3::v1::mv2::counter_semantic::unit_scale ( uint64_t  numerator,
uint64_t  denominator = 1 
)
inlinenoexcept

Set the unit scale as a fraction (numerator/denominator).

Parameters
numeratorScale numerator (should be 1 if not used).
denominatorScale denominator (should be 1 if not used).
Returns
Reference to this object for chaining.

Definition at line 3722 of file nvtx3.hpp.

◆ valuetype_absolute()

counter_semantic & nvtx3::v1::mv2::counter_semantic::valuetype_absolute ( )
inline

Set value type to absolute.

Exceptions
std::logic_errorif any valuetype_* setter has already been called on this object.
Returns
Reference to this object for chaining.

Definition at line 3751 of file nvtx3.hpp.

◆ valuetype_delta()

counter_semantic & nvtx3::v1::mv2::counter_semantic::valuetype_delta ( )
inline

Set value type to delta from previous sample.

Exceptions
std::logic_errorif any valuetype_* setter has already been called on this object.
Returns
Reference to this object for chaining.

Definition at line 3765 of file nvtx3.hpp.

◆ valuetype_delta_since_start()

counter_semantic & nvtx3::v1::mv2::counter_semantic::valuetype_delta_since_start ( )
inline

Set value type to delta since start.

Exceptions
std::logic_errorif any valuetype_* setter has already been called on this object.
Returns
Reference to this object for chaining.

Definition at line 3779 of file nvtx3.hpp.


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