NVTX C API Reference v3
NVIDIA Tools Extension Library
Loading...
Searching...
No Matches
Synchronization

This section covers a subset of the API that allow users to track additional synchronization details of their application. Naming OS synchronization primitives may allow users to better understand the data collected by traced synchronization APIs. Additionally, a user defined synchronization object can allow the users to to tell the tools when the user is building their own synchronization system that do not rely on the OS to provide behaviors and instead use techniques like atomic operations and spinlocks.

See module Synchronization for details.

Example:
class MyMutex
{
volatile long bLocked;
public:
MyMutex(const char* name, nvtxDomainHandle_t d){
bLocked = 0;
nvtxSyncUserAttributes_t attribs = { 0 };
attribs.version = NVTX_VERSION;
attribs.size = NVTX_SYNCUSER_ATTRIB_STRUCT_SIZE;
attribs.messageType = NVTX_MESSAGE_TYPE_ASCII;
attribs.message.ascii = name;
hSync = nvtxDomainSyncUserCreate(d, &attribs);
}
~MyMutex() {
}
bool Lock() {
bool acquired = __sync_bool_compare_and_swap(&bLocked, 0, 1);//atomic compiler intrinsic
if (acquired) {
}
else {
}
return acquired;
}
void Unlock() {
bLocked = false;
}
};
@ NVTX_MESSAGE_TYPE_ASCII
Definition: nvToolsExt.h:285
NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireStart(nvtxSyncUser_t handle)
Signal to tools that an attempt to acquire a user defined synchronization object.
NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireFailed(nvtxSyncUser_t handle)
Signal to tools of failure in acquiring a user defined synchronization object This should be called a...
NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserReleasing(nvtxSyncUser_t handle)
Signal to tools of releasing a reservation on user defined synchronization object This should be call...
NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireSuccess(nvtxSyncUser_t handle)
Signal to tools of success in acquiring a user defined synchronization object This should be called a...
struct nvtxSyncUser * nvtxSyncUser_t
User Defined Synchronization Object Handle . .
NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserDestroy(nvtxSyncUser_t handle)
Destroy a user defined synchronization object This is used to track non-OS synchronization working wi...
NVTX_DECLSPEC nvtxSyncUser_t NVTX_API nvtxDomainSyncUserCreate(nvtxDomainHandle_t domain, const nvtxSyncUserAttributes_t *attribs)
Create a user defined synchronization object This is used to track non-OS synchronization working wit...
#define NVTX_VERSION
Definition: nvToolsExt.h:155
Version
\NVTX_VERSION_2