3. Data Structures

Here are the data structures with brief descriptions:

nvtxEventAttributes_t
Event Attribute Structure
nvtxEventAttributes_t::​nvtxEventAttributes_v2::​payload_t
Payload assigned to this event
nvtxResourceAttributes_t
Resource Attribute Structure
nvtxResourceAttributes_t::​nvtxResourceAttributes_v0::​identifier_t
Identifier for the resource
nvtxSyncUserAttributes_t
User Defined Synchronization Object Attributes Structure

3.2. nvtxEventAttributes_v2::payload_t Union Reference

A numerical value that can be used to annotate an event. The tool could use the payload data to reconstruct graphs and diagrams.

3.4. nvtxResourceAttributes_v0::identifier_t Union Reference

An identifier may be a pointer or a handle to an OS or middleware API object. The resource type will assist in avoiding collisions where handles values may collide.

3.5. nvtxSyncUserAttributes_v0 Struct Reference

[Synchronization]

This structure is used to describe the attributes of a user defined synchronization object. 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:

  • Zero the structure

  • Set the version field

  • Set the size field

Zeroing the structure sets all the event 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

‎ nvtxSyncUserAttributes_t attribs = {0};
       attribs.version = NVTX_VERSION;
       attribs.size = NVTX_SYNCUSER_ATTRIB_STRUCT_SIZE;

Method 2: Initializing nvtxSyncUserAttributes_t for a specific version

‎ nvtxSyncUserAttributes_t attribs = {0};
       attribs.version = 1;
       attribs.size = (uint16_t)(sizeof(nvtxSyncUserAttributes_t));

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_SYNCUSER_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:

‎ // Initialize
       nvtxSyncUserAttributes_t attribs = {0};
       attribs.version = NVTX_VERSION;
       attribs.size = NVTX_SYNCUSER_ATTRIB_STRUCT_SIZE;
      
       // Configure the Attributes
       attribs.messageType = NVTX_MESSAGE_TYPE_ASCII;
       attribs.message.ascii = "Example";

See also:

nvtxDomainSyncUserCreate

Public Variables

nvtxMessageValue_t  message
Message assigned to this 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.

Variables

nvtxMessageValue_t nvtxSyncUserAttributes_v0::message [inherited]

Message assigned to this attribute structure. The text message that is attached to an event.

int32_t nvtxSyncUserAttributes_v0::messageType [inherited]

Message type specified in this attribute structure. Defines the message format of the attribute structure's message field.

Default Value is NVTX_MESSAGE_UNKNOWN

uint16_t nvtxSyncUserAttributes_v0::size [inherited]

Size of the structure. Needs to be set to the size in bytes of the event attribute structure used to specify the event.

uint16_t nvtxSyncUserAttributes_v0::version [inherited]

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.