NVTX  v3
NVIDIA Tools Extension Library
nvToolsExtSync.h
1 /*
2 * Copyright 2009-2020 NVIDIA Corporation. All rights reserved.
3 *
4 * Licensed under the Apache License v2.0 with LLVM Exceptions.
5 * See https://llvm.org/LICENSE.txt for license information.
6 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 */
8 
9 #include "nvToolsExt.h"
10 
11 #ifndef NVTOOLSEXT_SYNC_V3
12 #define NVTOOLSEXT_SYNC_V3
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif /* __cplusplus */
17 
18 /* \cond SHOW_HIDDEN
19 * \version \NVTX_VERSION_2
20 */
21 #define NVTX_SYNCUSER_ATTRIB_STRUCT_SIZE ( (uint16_t)( sizeof(nvtxSyncUserAttributes_v0) ) )
22 
83 /* ------------------------------------------------------------------------- */
84 /* \cond SHOW_HIDDEN
85 * \brief Used to build a non-colliding value for resource types separated class
86 * \version \NVTX_VERSION_2
87 */
88 #define NVTX_RESOURCE_CLASS_SYNC_OS 2
89 #define NVTX_RESOURCE_CLASS_SYNC_PTHREAD 3
93 /* ------------------------------------------------------------------------- */
94 
102 {
103  NVTX_RESOURCE_TYPE_SYNC_PTHREAD_MUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 1), /* pthread_mutex_t */
104  NVTX_RESOURCE_TYPE_SYNC_PTHREAD_CONDITION = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 2), /* pthread_cond_t */
105  NVTX_RESOURCE_TYPE_SYNC_PTHREAD_RWLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 3), /* pthread_rwlock_t */
106  NVTX_RESOURCE_TYPE_SYNC_PTHREAD_BARRIER = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 4), /* pthread_barrier_t */
107  NVTX_RESOURCE_TYPE_SYNC_PTHREAD_SPINLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 5), /* pthread_spinlock_t */
108  NVTX_RESOURCE_TYPE_SYNC_PTHREAD_ONCE = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 6) /* pthread_once_t */
110 
114 {
115  NVTX_RESOURCE_TYPE_SYNC_WINDOWS_MUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 1),
116  NVTX_RESOURCE_TYPE_SYNC_WINDOWS_SEMAPHORE = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 2),
117  NVTX_RESOURCE_TYPE_SYNC_WINDOWS_EVENT = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 3),
118  NVTX_RESOURCE_TYPE_SYNC_WINDOWS_CRITICAL_SECTION = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 4),
119  NVTX_RESOURCE_TYPE_SYNC_WINDOWS_SRWLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 5)
121 
127 {
128  NVTX_RESOURCE_TYPE_SYNC_LINUX_MUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 1),
129  NVTX_RESOURCE_TYPE_SYNC_LINUX_FUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 2),
130  NVTX_RESOURCE_TYPE_SYNC_LINUX_SEMAPHORE = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 3),
131  NVTX_RESOURCE_TYPE_SYNC_LINUX_COMPLETION = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 4),
132  NVTX_RESOURCE_TYPE_SYNC_LINUX_SPINLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 5),
133  NVTX_RESOURCE_TYPE_SYNC_LINUX_SEQLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 6),
134  NVTX_RESOURCE_TYPE_SYNC_LINUX_RCU = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 7)
136 
143 
152 typedef struct nvtxSyncUser* nvtxSyncUser_t;
153 
224 {
232  uint16_t version;
233 
240  uint16_t size;
241 
249  int32_t messageType; /* nvtxMessageType_t */
250 
256 
258 
259 typedef struct nvtxSyncUserAttributes_v0 nvtxSyncUserAttributes_t;
260 
261 /* ------------------------------------------------------------------------- */
280 NVTX_DECLSPEC nvtxSyncUser_t NVTX_API nvtxDomainSyncUserCreate(nvtxDomainHandle_t domain, const nvtxSyncUserAttributes_t* attribs);
281 
282 /* ------------------------------------------------------------------------- */
298 NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserDestroy(nvtxSyncUser_t handle);
299 
300 /* ------------------------------------------------------------------------- */
315 NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireStart(nvtxSyncUser_t handle);
316 
317 /* ------------------------------------------------------------------------- */NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireFailed(nvtxSyncUser_t handle);
333 
334 /* ------------------------------------------------------------------------- */NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireSuccess(nvtxSyncUser_t handle);
350 
351 /* ------------------------------------------------------------------------- */
367 NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserReleasing(nvtxSyncUser_t handle);
368 
369  /*END defgroup*/
371 
372 #ifdef __cplusplus
373 }
374 #endif /* __cplusplus */
375 
376 #ifndef NVTX_NO_IMPL
377 #define NVTX_IMPL_GUARD_SYNC /* Ensure other headers cannot included directly */
378 #include "nvtxDetail/nvtxImplSync_v3.h"
379 #undef NVTX_IMPL_GUARD_SYNC
380 #endif /*NVTX_NO_IMPL*/
381 
382 #endif /* NVTOOLSEXT_SYNC_V3 */
uint16_t size
Size of the structure.
enum nvtxResourceSyncLinuxType_t nvtxResourceSyncAndroidType_t
Resource type values for Android come from Linux.
nvtxMessageValue_t message
Message assigned to this attribute structure.
User Defined Synchronization Object Attributes Structure.
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...
struct nvtxSyncUser * nvtxSyncUser_t
User Defined Synchronization Object Handle .
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 nvtxDomainSyncUserAcquireStart(nvtxSyncUser_t handle)
Signal to tools that an attempt to acquire a user defined synchronization object. ...
int32_t messageType
Message type specified in this attribute structure.
nvtxResourceSyncPosixThreadType_t
Resource type values for OSs with POSIX Thread API support.
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...
nvtxResourceSyncLinuxType_t
Resource type values for Linux and Linux derived OSs such as Android.
uint16_t version
Version flag of the structure.
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...
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...
nvtxResourceSyncWindowsType_t
Resource type values for Windows OSs.