NVTX C++ API Reference 1.0
C++ convenience wrappers for NVTX v3 C API
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
nvtx3::v1::mv2::scope Class Reference

Type-safe wrapper for NVTX scope identifiers. More...

#include <nvtx3.hpp>

Public Types

using value_type = uint64_t
 

Public Member Functions

constexpr scope (value_type id) noexcept
 Explicit constructor from a raw scope ID.
 
constexpr value_type get () const noexcept
 Get the underlying scope ID.
 

Static Public Member Functions

static constexpr scope none () noexcept
 No scope specified.
 
static constexpr scope root () noexcept
 The root in a hierarchy.
 
static constexpr scope current_hw_machine () noexcept
 Node/machine name.
 
static constexpr scope current_hw_socket () noexcept
 
static constexpr scope current_hw_cpu_physical () noexcept
 Physical CPU core.
 
static constexpr scope current_hw_cpu_logical () noexcept
 Logical CPU core.
 
static constexpr scope current_hw_innermost () noexcept
 Innermost HW execution context.
 
static constexpr scope current_hypervisor () noexcept
 
static constexpr scope current_vm () noexcept
 
static constexpr scope current_kernel () noexcept
 
static constexpr scope current_container () noexcept
 
static constexpr scope current_os () noexcept
 
static constexpr scope current_sw_process () noexcept
 Process scope.
 
static constexpr scope current_sw_thread () noexcept
 Thread scope.
 
static constexpr scope current_sw_innermost () noexcept
 Innermost SW execution context.
 

Detailed Description

Type-safe wrapper for NVTX scope identifiers.

Scopes define the context in which a counter is meaningful, such as process-wide or thread-local.

Predefined scopes are available as static member functions. Custom scopes can be created using explicit construction from a raw scope ID (C interop) or in future versions via nvtxScopeRegister.

Example:

// Use predefined scopes
nvtx3::counter<int64_t> c1{"counter", nvtx3::scope::current_sw_process()};
// C interop: wrap a raw scope ID
uint64_t raw_id = some_c_api_returning_scope();
nvtx3::scope custom{raw_id};
nvtx3::counter<int64_t> c2{"counter", custom};
Type-safe wrapper for NVTX scope identifiers.
Definition nvtx3.hpp:3538
static constexpr scope current_sw_process() noexcept
Process scope.
Definition nvtx3.hpp:3583

Definition at line 3538 of file nvtx3.hpp.

Member Typedef Documentation

◆ value_type

using nvtx3::v1::mv2::scope::value_type = uint64_t

Definition at line 3540 of file nvtx3.hpp.

Constructor & Destructor Documentation

◆ scope()

constexpr nvtx3::v1::mv2::scope::scope ( value_type  id)
inlineexplicitconstexprnoexcept

Explicit constructor from a raw scope ID.

Use this for C API interoperability when you have a scope ID from nvtxScopeRegister or similar.

Parameters
idThe raw scope ID.

Definition at line 3550 of file nvtx3.hpp.

Member Function Documentation

◆ current_container()

static constexpr scope nvtx3::v1::mv2::scope::current_container ( )
inlinestaticconstexprnoexcept

Definition at line 3578 of file nvtx3.hpp.

◆ current_hw_cpu_logical()

static constexpr scope nvtx3::v1::mv2::scope::current_hw_cpu_logical ( )
inlinestaticconstexprnoexcept

Logical CPU core.

Definition at line 3570 of file nvtx3.hpp.

◆ current_hw_cpu_physical()

static constexpr scope nvtx3::v1::mv2::scope::current_hw_cpu_physical ( )
inlinestaticconstexprnoexcept

Physical CPU core.

Definition at line 3568 of file nvtx3.hpp.

◆ current_hw_innermost()

static constexpr scope nvtx3::v1::mv2::scope::current_hw_innermost ( )
inlinestaticconstexprnoexcept

Innermost HW execution context.

Definition at line 3572 of file nvtx3.hpp.

◆ current_hw_machine()

static constexpr scope nvtx3::v1::mv2::scope::current_hw_machine ( )
inlinestaticconstexprnoexcept

Node/machine name.

Definition at line 3565 of file nvtx3.hpp.

◆ current_hw_socket()

static constexpr scope nvtx3::v1::mv2::scope::current_hw_socket ( )
inlinestaticconstexprnoexcept

Definition at line 3566 of file nvtx3.hpp.

◆ current_hypervisor()

static constexpr scope nvtx3::v1::mv2::scope::current_hypervisor ( )
inlinestaticconstexprnoexcept

Definition at line 3575 of file nvtx3.hpp.

◆ current_kernel()

static constexpr scope nvtx3::v1::mv2::scope::current_kernel ( )
inlinestaticconstexprnoexcept

Definition at line 3577 of file nvtx3.hpp.

◆ current_os()

static constexpr scope nvtx3::v1::mv2::scope::current_os ( )
inlinestaticconstexprnoexcept

Definition at line 3579 of file nvtx3.hpp.

◆ current_sw_innermost()

static constexpr scope nvtx3::v1::mv2::scope::current_sw_innermost ( )
inlinestaticconstexprnoexcept

Innermost SW execution context.

Definition at line 3587 of file nvtx3.hpp.

◆ current_sw_process()

static constexpr scope nvtx3::v1::mv2::scope::current_sw_process ( )
inlinestaticconstexprnoexcept

Process scope.

Definition at line 3583 of file nvtx3.hpp.

◆ current_sw_thread()

static constexpr scope nvtx3::v1::mv2::scope::current_sw_thread ( )
inlinestaticconstexprnoexcept

Thread scope.

Definition at line 3585 of file nvtx3.hpp.

◆ current_vm()

static constexpr scope nvtx3::v1::mv2::scope::current_vm ( )
inlinestaticconstexprnoexcept

Definition at line 3576 of file nvtx3.hpp.

◆ get()

constexpr value_type nvtx3::v1::mv2::scope::get ( ) const
inlineconstexprnoexcept

Get the underlying scope ID.

Returns
The raw scope ID for C API interop.

Definition at line 3556 of file nvtx3.hpp.

◆ none()

static constexpr scope nvtx3::v1::mv2::scope::none ( )
inlinestaticconstexprnoexcept

No scope specified.

Definition at line 3559 of file nvtx3.hpp.

◆ root()

static constexpr scope nvtx3::v1::mv2::scope::root ( )
inlinestaticconstexprnoexcept

The root in a hierarchy.

Definition at line 3561 of file nvtx3.hpp.


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