NVTX C API Reference v3
NVIDIA Tools Extension Library
Loading...
Searching...
No Matches
Data Structures | Data Fields
nvtxResourceAttributes_t Struct Reference

Resource Attribute Structure. . More...

#include <nvToolsExt.h>

Data Structures

union  identifier_t
 Identifier for the resource. . More...
 

Data Fields

uint16_t version
 Version flag of the structure. More...
 
uint16_t size
 Size of the structure. More...
 
int32_t identifierType
 Identifier type specifies how to interpret the identifier field. More...
 
union nvtxResourceAttributes_v0::identifier_t identifier
 
int32_t messageType
 Message type specified in this attribute structure. More...
 
nvtxMessageValue_t message
 Message assigned to this attribute structure.. More...
 

Detailed Description

Resource Attribute Structure. .

This structure is used to describe the attributes of a resource. The layout of the structure is defined by a specific version of the tools extension library and can change between different versions of the Tools Extension library.

Initializing the Attributes

The caller should always perform the following three tasks when using attributes:

Zeroing the structure sets all the resource attributes types and values to the default value.

The version and size field are used by the Tools Extension implementation to handle multiple versions of the attributes structure.

It is recommended that the caller use one of the following to methods to initialize the event attributes structure:

Method 1: Initializing nvtxEventAttributes for future compatibility
nvtxResourceAttributes_t attribs = {0};
attribs.version = NVTX_VERSION;
attribs.size = NVTX_RESOURCE_ATTRIB_STRUCT_SIZE;
#define NVTX_VERSION
Definition: nvToolsExt.h:155
Method 2: Initializing nvtxEventAttributes for a specific version
attribs.version = 2;
attribs.size = (uint16_t)(sizeof(nvtxResourceAttributes_v0));
Resource Attribute Structure. .
Definition: nvToolsExt.h:1036
uint16_t size
Size of the structure.
Definition: nvToolsExt.h:1052
uint16_t version
Version flag of the structure.
Definition: nvToolsExt.h:1044

If the caller uses Method 1 it is critical that the entire binary layout of the structure be configured to 0 so that all fields are initialized to the default value.

The caller should either use both NVTX_VERSION and NVTX_RESOURCE_ATTRIB_STRUCT_SIZE (Method 1) or use explicit values and a versioned type (Method 2). Using a mix of the two methods will likely cause either source level incompatibility or binary incompatibility in the future.

Settings Attribute Types and Values
Example:
nvtxDomainHandle_t domain = nvtxDomainCreateA("example domain");
// Initialize
nvtxResourceAttributes_t attribs = {0};
attribs.size = NVTX_RESOURCE_ATTRIB_STRUCT_SIZE;
// Configure the Attributes
attribs.identifierType = NVTX_RESOURCE_TYPE_GENERIC_POINTER;
attribs.identifier.pValue = (const void*)pMutex;
attribs.messageType = NVTX_MESSAGE_TYPE_ASCII;
attribs.message.ascii = "Single thread access to database.";
nvtxResourceHandle_t handle = nvtxDomainResourceCreate(domain, attribs);
NVTX_DECLSPEC nvtxDomainHandle_t NVTX_API nvtxDomainCreateA(const char *name)
Register a NVTX domain.
@ NVTX_MESSAGE_TYPE_ASCII
Definition: nvToolsExt.h:285
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_RESOURCE_TYPE_GENERIC_POINTER
Definition: nvToolsExt.h:952
See also
nvtxDomainResourceCreate

Definition at line 1035 of file nvToolsExt.h.

Field Documentation

◆ identifierType

int32_t nvtxResourceAttributes_t::identifierType

Identifier type specifies how to interpret the identifier field.

Defines the identifier format of the attribute structure's identifier field.

Default Value is NVTX_RESOURCE_TYPE_UNKNOWN

Definition at line 1062 of file nvToolsExt.h.

◆ message

nvtxMessageValue_t nvtxResourceAttributes_t::message

Message assigned to this attribute structure..

The text message that is attached to a resource.

Definition at line 1090 of file nvToolsExt.h.

◆ messageType

int32_t nvtxResourceAttributes_t::messageType

Message type specified in this attribute structure.

Defines the message format of the attribute structure's message field.

Default Value is NVTX_MESSAGE_UNKNOWN

Definition at line 1084 of file nvToolsExt.h.

◆ size

uint16_t nvtxResourceAttributes_t::size

Size of the structure.

Needs to be set to the size in bytes of this attribute structure.

Definition at line 1052 of file nvToolsExt.h.

◆ version

uint16_t nvtxResourceAttributes_t::version

Version flag of the structure.

Needs to be set to NVTX_VERSION to indicate the version of NVTX APIs supported in this header file. This can optionally be overridden to another version of the tools extension library.

Definition at line 1044 of file nvToolsExt.h.


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