164#if defined(NVTX_VERSION) && NVTX_VERSION < 3
165#error "Trying to #include NVTX version 3 in a source file where an older NVTX version has already been included. If you are not directly using NVTX (the NVIDIA Tools Extension library), you are getting this error because libraries you are using have included different versions of NVTX. Suggested solutions are: (1) reorder #includes so the newest NVTX version is included first, (2) avoid using the conflicting libraries in the same .c/.cpp file, or (3) update the library using the older NVTX version to use the newer version instead."
168#if defined(NVTX_AS_SYSTEM_HEADER)
169#if defined(__clang__)
170#pragma clang system_header
171#elif defined(__GNUC__) || defined(__NVCOMPILER)
172#pragma GCC system_header
173#elif defined(_MSC_VER)
179#if !defined(NVTX_VERSION)
180#define NVTX_VERSION 3
201#define NVTX_API __stdcall
204#define NVTX_DYNAMIC_EXPORT __declspec(dllexport)
206#define NVTX_DYNAMIC_EXPORT __attribute__((visibility("default"))) __declspec(dllexport)
209#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_ARM64EC))
210#define NVTX_EXPORT_UNMANGLED_FUNCTION_NAME __pragma(comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__))
212#define NVTX_EXPORT_UNMANGLED_FUNCTION_NAME
219#define NVTX_DYNAMIC_EXPORT __attribute__((visibility("default")))
221#define NVTX_EXPORT_UNMANGLED_FUNCTION_NAME
233#define NVTX_INLINE_STATIC __inline static
237#if defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
238#define NVTX_INLINE_STATIC inline static
240#define NVTX_INLINE_STATIC __inline__ static
245#if !defined(NVTX_NULLPTR)
246#if defined(__cplusplus) && __cplusplus >= 201103L
247#define NVTX_NULLPTR nullptr
249#define NVTX_NULLPTR NULL
253#if defined(__cplusplus)
254#define NVTX_STATIC_CAST(type, value) (static_cast<type>(value))
255#define NVTX_REINTERPRET_CAST(type, value) (reinterpret_cast<type>(value))
257#define NVTX_STATIC_CAST(type, value) ((type)(value))
258#define NVTX_REINTERPRET_CAST(type, value) ((type)(value))
307#if defined(NVTX_NO_IMPL)
311#if !defined(NVTX_DECLSPEC)
314#if !defined(NVTX_SET_NAME_MANGLING_OPTIONS)
315#define NVTX_SET_NAME_MANGLING_OPTIONS
318#elif defined(NVTX_EXPORT_API)
323#if !defined(NVTX_DECLSPEC)
324#define NVTX_DECLSPEC NVTX_DYNAMIC_EXPORT
326#if !defined(NVTX_SET_NAME_MANGLING_OPTIONS)
327#define NVTX_SET_NAME_MANGLING_OPTIONS NVTX_EXPORT_UNMANGLED_FUNCTION_NAME
334#if !defined(NVTX_DECLSPEC)
335#define NVTX_DECLSPEC NVTX_INLINE_STATIC
337#if !defined(NVTX_SET_NAME_MANGLING_OPTIONS)
338#define NVTX_SET_NAME_MANGLING_OPTIONS
346#include "nvtxDetail/nvtxLinkOnce.h"
351#define NVTX_VERSIONED_IDENTIFIER_L3(NAME, VERSION) NAME##_v##VERSION
352#define NVTX_VERSIONED_IDENTIFIER_L2(NAME, VERSION) NVTX_VERSIONED_IDENTIFIER_L3(NAME, VERSION)
353#define NVTX_VERSIONED_IDENTIFIER(NAME) NVTX_VERSIONED_IDENTIFIER_L2(NAME, NVTX_VERSION)
374#ifndef NVTX_STDINT_TYPES_ALREADY_DEFINED
387#define NVTX_SUCCESS 0
389#define NVTX_ERR_INIT_LOAD_PROPERTY 2
390#define NVTX_ERR_INIT_ACCESS_LIBRARY 3
391#define NVTX_ERR_INIT_LOAD_LIBRARY 4
392#define NVTX_ERR_INIT_MISSING_LIBRARY_ENTRY_POINT 5
393#define NVTX_ERR_INIT_FAILED_LIBRARY_ENTRY_POINT 6
394#define NVTX_ERR_NO_INJECTION_LIBRARY_AVAILABLE 7
399#define NVTX_EVENT_ATTRIB_STRUCT_SIZE (NVTX_STATIC_CAST(uint16_t, sizeof(nvtxEventAttributes_t)))
401#define NVTX_NO_PUSH_POP_TRACKING (NVTX_STATIC_CAST(int, -2))
403typedef uint64_t nvtxRangeId_t;
406struct nvtxDomainRegistration_st;
407typedef struct nvtxDomainRegistration_st nvtxDomainRegistration;
417typedef nvtxDomainRegistration* nvtxDomainHandle_t;
420struct nvtxStringRegistration_st;
421typedef struct nvtxStringRegistration_st nvtxStringRegistration;
431typedef nvtxStringRegistration* nvtxStringHandle_t;
464 const wchar_t* unicode;
466 nvtxStringHandle_t registered;
721NVTX_DECLSPEC
void NVTX_API
nvtxDomainMarkEx(nvtxDomainHandle_t domain,
const nvtxEventAttributes_t* eventAttrib);
758NVTX_DECLSPEC
void NVTX_API
nvtxMarkEx(
const nvtxEventAttributes_t* eventAttrib);
783NVTX_DECLSPEC
void NVTX_API nvtxMarkW(
const wchar_t*
message);
819NVTX_DECLSPEC nvtxRangeId_t NVTX_API
nvtxDomainRangeStartEx(nvtxDomainHandle_t domain,
const nvtxEventAttributes_t* eventAttrib);
854NVTX_DECLSPEC nvtxRangeId_t NVTX_API
nvtxRangeStartEx(
const nvtxEventAttributes_t* eventAttrib);
883NVTX_DECLSPEC nvtxRangeId_t NVTX_API nvtxRangeStartW(
const wchar_t*
message);
972NVTX_DECLSPEC
int NVTX_API
nvtxDomainRangePushEx(nvtxDomainHandle_t domain,
const nvtxEventAttributes_t* eventAttrib);
1038NVTX_DECLSPEC
int NVTX_API nvtxRangePushW(
const wchar_t*
message);
1127#define NVTX_RESOURCE_MAKE_TYPE(CLASS, INDEX) (((NVTX_STATIC_CAST(uint32_t, NVTX_RESOURCE_CLASS_ ## CLASS))<<16)|(NVTX_STATIC_CAST(uint32_t, INDEX)))
1128#define NVTX_RESOURCE_CLASS_GENERIC 1
1141 NVTX_RESOURCE_TYPE_UNKNOWN = 0,
1288#define NVTX_RESOURCE_ATTRIB_STRUCT_SIZE (NVTX_STATIC_CAST(uint16_t, sizeof(nvtxResourceAttributes_v0)))
1289typedef struct nvtxResourceHandle* nvtxResourceHandle_t;
1392NVTX_DECLSPEC
void NVTX_API nvtxDomainNameCategoryW(nvtxDomainHandle_t domain, uint32_t category,
const wchar_t* name);
1418NVTX_DECLSPEC
void NVTX_API nvtxNameCategoryW(uint32_t category,
const wchar_t* name);
1487NVTX_DECLSPEC
void NVTX_API nvtxNameOsThreadW(uint32_t threadId,
const wchar_t* name);
1537NVTX_DECLSPEC nvtxStringHandle_t NVTX_API nvtxDomainRegisterStringW(nvtxDomainHandle_t domain,
const wchar_t*
string);
1601NVTX_DECLSPEC nvtxDomainHandle_t NVTX_API nvtxDomainCreateW(
const wchar_t* name);
1634 #define nvtxMark nvtxMarkW
1635 #define nvtxRangeStart nvtxRangeStartW
1636 #define nvtxRangePush nvtxRangePushW
1637 #define nvtxNameCategory nvtxNameCategoryW
1638 #define nvtxNameOsThread nvtxNameOsThreadW
1640 #define nvtxDomainCreate nvtxDomainCreateW
1641 #define nvtxDomainRegisterString nvtxDomainRegisterStringW
1642 #define nvtxDomainNameCategory nvtxDomainNameCategoryW
1644 #define nvtxMark nvtxMarkA
1645 #define nvtxRangeStart nvtxRangeStartA
1646 #define nvtxRangePush nvtxRangePushA
1647 #define nvtxNameCategory nvtxNameCategoryA
1648 #define nvtxNameOsThread nvtxNameOsThreadA
1650 #define nvtxDomainCreate nvtxDomainCreateA
1651 #define nvtxDomainRegisterString nvtxDomainRegisterStringA
1652 #define nvtxDomainNameCategory nvtxDomainNameCategoryA
1661#define NVTX_IMPL_GUARD
1663#include "nvtxDetail/nvtxTypes.h"
1666#include "nvtxDetail/nvtxImpl.h"
1669#undef NVTX_IMPL_GUARD
NVTX_DECLSPEC nvtxDomainHandle_t NVTX_API nvtxDomainCreateA(const char *name)
Register a NVTX domain.
NVTX_DECLSPEC void NVTX_API nvtxDomainDestroy(nvtxDomainHandle_t domain)
Unregister a NVTX domain.
@ NVTX_PAYLOAD_TYPE_INT32
@ NVTX_PAYLOAD_TYPE_DOUBLE
@ NVTX_PAYLOAD_TYPE_UNSIGNED_INT32
@ NVTX_PAYLOAD_TYPE_FLOAT
@ NVTX_PAYLOAD_TYPE_INT64
@ NVTX_PAYLOAD_TYPE_UNSIGNED_INT64
NVTX_DECLSPEC void NVTX_API nvtxInitialize(const void *reserved)
Force initialization (optional) .
@ NVTX_MESSAGE_TYPE_REGISTERED
@ NVTX_MESSAGE_TYPE_UNICODE
@ NVTX_MESSAGE_TYPE_ASCII
NVTX_DECLSPEC int NVTX_API nvtxDomainRangePop(nvtxDomainHandle_t domain)
Ends a nested thread range.
NVTX_DECLSPEC void NVTX_API nvtxDomainRangeEnd(nvtxDomainHandle_t domain, nvtxRangeId_t id)
Ends a process range.
NVTX_DECLSPEC nvtxRangeId_t NVTX_API nvtxRangeStartA(const char *message)
Starts a process range.
NVTX_DECLSPEC int NVTX_API nvtxRangePop(void)
Ends a nested thread range.
NVTX_DECLSPEC int NVTX_API nvtxDomainRangePushEx(nvtxDomainHandle_t domain, const nvtxEventAttributes_t *eventAttrib)
Starts a nested thread range.
NVTX_DECLSPEC void NVTX_API nvtxRangeEnd(nvtxRangeId_t id)
Ends a process range.
NVTX_DECLSPEC int NVTX_API nvtxRangePushA(const char *message)
Starts a nested thread range.
NVTX_DECLSPEC void NVTX_API nvtxDomainMarkEx(nvtxDomainHandle_t domain, const nvtxEventAttributes_t *eventAttrib)
Marks an instantaneous event in the application.
NVTX_DECLSPEC void NVTX_API nvtxMarkEx(const nvtxEventAttributes_t *eventAttrib)
Marks an instantaneous event in the application.
NVTX_DECLSPEC void NVTX_API nvtxMarkA(const char *message)
Marks an instantaneous event in the application.
NVTX_DECLSPEC int NVTX_API nvtxRangePushEx(const nvtxEventAttributes_t *eventAttrib)
Starts a nested thread range.
NVTX_DECLSPEC nvtxRangeId_t NVTX_API nvtxRangeStartEx(const nvtxEventAttributes_t *eventAttrib)
Starts a process range.
NVTX_DECLSPEC nvtxRangeId_t NVTX_API nvtxDomainRangeStartEx(nvtxDomainHandle_t domain, const nvtxEventAttributes_t *eventAttrib)
Starts a process range in a domain.
NVTX_DECLSPEC nvtxResourceHandle_t NVTX_API nvtxDomainResourceCreate(nvtxDomainHandle_t domain, nvtxResourceAttributes_t *attribs)
Create a resource object to track and associate data with OS and middleware objects.
NVTX_DECLSPEC void NVTX_API nvtxNameCategoryA(uint32_t category, const char *name)
Annotate an NVTX category.
NVTX_DECLSPEC void NVTX_API nvtxDomainResourceDestroy(nvtxResourceHandle_t resource)
Destroy a resource object to track and associate data with OS and middleware objects.
nvtxResourceGenericType_t
Generic resource type for when a resource class is not available.
NVTX_DECLSPEC void NVTX_API nvtxNameOsThreadA(uint32_t threadId, const char *name)
Annotate an OS thread.
NVTX_DECLSPEC void NVTX_API nvtxDomainNameCategoryA(nvtxDomainHandle_t domain, uint32_t category, const char *name)
Annotate an NVTX category used within a domain.
@ NVTX_RESOURCE_TYPE_GENERIC_THREAD_POSIX
@ NVTX_RESOURCE_TYPE_GENERIC_HANDLE
@ NVTX_RESOURCE_TYPE_GENERIC_POINTER
@ NVTX_RESOURCE_TYPE_GENERIC_THREAD_NATIVE
NVTX_DECLSPEC nvtxStringHandle_t NVTX_API nvtxDomainRegisterStringA(nvtxDomainHandle_t domain, const char *string)
Register a string.
Event Attribute Structure. .
uint16_t version
Version flag of the structure.
int32_t colorType
Color type specified in this attribute structure.
uint16_t size
Size of the structure.
int32_t payloadType
Payload type specified in this attribute structure.
nvtxMessageValue_t message
Message assigned to this attribute structure..
int32_t messageType
Message type specified in this attribute structure.
uint32_t color
Color assigned to this event..
uint32_t category
ID of the category the event is assigned to.
Resource Attribute Structure. .
int32_t messageType
Message type specified in this attribute structure.
uint16_t size
Size of the structure.
uint16_t version
Version flag of the structure.
nvtxMessageValue_t message
Message assigned to this attribute structure..
int32_t identifierType
Identifier type specifies how to interpret the identifier field.
Payload assigned to this event..
Identifier for the resource. .