Data Structures | Data Fields
nvtxEventAttributes_v1 Struct Reference

Event Attribute Structure. More...

Data Structures

union  message_t
 Message assigned to this attribute structure. More...
union  payload_t
 Payload assigned to this event. More...

Data Fields

uint16_t version
 Version flag of the structure.
uint16_t size
 Size of the structure.
uint32_t category
 ID of the category the event is assigned to.
int32_t colorType
 Color type specified in this attribute structure.
uint32_t color
 Color assigned to this event.
int32_t payloadType
 Payload type specified in this attribute structure.
int32_t reserved0
union
nvtxEventAttributes_v1::payload_t 
payload
int32_t messageType
 Message type specified in this attribute structure.
union
nvtxEventAttributes_v1::message_t 
message

Detailed Description

This structure is used to describe the attributes of an event. 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 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
nvtxEventAttributes_t eventAttrib = {0};
eventAttrib.version = NVTX_VERSION;
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
Method 2: Initializing nvtxEventAttributes for a specific version
nvtxEventAttributes_t eventAttrib = {0};
eventAttrib.version = 1;
eventAttrib.size = (uint16_t)(sizeof(nvtxEventAttributes_v1));

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_EVENT_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
nvtxEventAttributes_t eventAttrib = {0};
eventAttrib.version = NVTX_VERSION;
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
// Configure the Attributes
eventAttrib.colorType = NVTX_COLOR_ARGB;
eventAttrib.color = 0xFF880000;
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
eventAttrib.message.ascii = "Example";

In the example the caller does not have to set the value of nvtxEventAttributes_v1::category or nvtxEventAttributes_v1::payload as these fields were set to the default value by {0}.

See also:
nvtxMarkEx nvtxRangeStartEx nvtxRangePushEx

Generated by Doxygen for NVIDIA Tools Extension Library  NVIDIA