NVTX C API Reference v3
NVIDIA Tools Extension Library
Loading...
Searching...
No Matches
nvToolsExtSync.h
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2009-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Licensed under the Apache License v2.0 with LLVM Exceptions.
18 * See https://nvidia.github.io/NVTX/LICENSE.txt for license information.
19 */
20
21#if defined(NVTX_AS_SYSTEM_HEADER)
22#if defined(__clang__)
23#pragma clang system_header
24#elif defined(__GNUC__) || defined(__NVCOMPILER)
25#pragma GCC system_header
26#elif defined(_MSC_VER)
27#pragma system_header
28#endif
29#endif
30
31#include "nvToolsExt.h"
32
33#ifndef NVTOOLSEXT_SYNC_V3
34#define NVTOOLSEXT_SYNC_V3
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
40/* \cond SHOW_HIDDEN
41* \version NVTX_VERSION_2
42*/
43#define NVTX_SYNCUSER_ATTRIB_STRUCT_SIZE (NVTX_STATIC_CAST(uint16_t, sizeof(nvtxSyncUserAttributes_v0)))
106/* ------------------------------------------------------------------------- */
107/* \cond SHOW_HIDDEN
108* \brief Used to build a non-colliding value for resource types separated class
109* \version NVTX_VERSION_2
110*/
111#define NVTX_RESOURCE_CLASS_SYNC_OS 2
112#define NVTX_RESOURCE_CLASS_SYNC_PTHREAD 3
116/* ------------------------------------------------------------------------- */
125{
126 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_MUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 1), /* pthread_mutex_t */
127 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_CONDITION = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 2), /* pthread_cond_t */
128 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_RWLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 3), /* pthread_rwlock_t */
129 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_BARRIER = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 4), /* pthread_barrier_t */
130 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_SPINLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 5), /* pthread_spinlock_t */
131 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_ONCE = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 6) /* pthread_once_t */
133
137{
138 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_MUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 1),
139 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_SEMAPHORE = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 2),
140 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_EVENT = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 3),
141 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_CRITICAL_SECTION = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 4),
142 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_SRWLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 5)
144
150{
151 NVTX_RESOURCE_TYPE_SYNC_LINUX_MUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 1),
152 NVTX_RESOURCE_TYPE_SYNC_LINUX_FUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 2),
153 NVTX_RESOURCE_TYPE_SYNC_LINUX_SEMAPHORE = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 3),
154 NVTX_RESOURCE_TYPE_SYNC_LINUX_COMPLETION = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 4),
155 NVTX_RESOURCE_TYPE_SYNC_LINUX_SPINLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 5),
156 NVTX_RESOURCE_TYPE_SYNC_LINUX_SEQLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 6),
157 NVTX_RESOURCE_TYPE_SYNC_LINUX_RCU = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 7)
159
166
175typedef struct nvtxSyncUser* nvtxSyncUser_t;
176
246{
254 uint16_t version;
255
262 uint16_t size;
263
271 int32_t messageType; /* nvtxMessageType_t */
272
278
280
281typedef struct nvtxSyncUserAttributes_v0 nvtxSyncUserAttributes_t;
282
283/* ------------------------------------------------------------------------- */
302NVTX_DECLSPEC nvtxSyncUser_t NVTX_API nvtxDomainSyncUserCreate(nvtxDomainHandle_t domain, const nvtxSyncUserAttributes_t* attribs);
303
304/* ------------------------------------------------------------------------- */
320NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserDestroy(nvtxSyncUser_t handle);
321
322/* ------------------------------------------------------------------------- */
337NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireStart(nvtxSyncUser_t handle);
338
339/* ------------------------------------------------------------------------- */
355NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireFailed(nvtxSyncUser_t handle);
356
357/* ------------------------------------------------------------------------- */
373NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireSuccess(nvtxSyncUser_t handle);
374
375/* ------------------------------------------------------------------------- */
391NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserReleasing(nvtxSyncUser_t handle);
392
393
/*END defgroup*/
395
396#ifdef __cplusplus
397}
398#endif /* __cplusplus */
399
400#ifndef NVTX_NO_IMPL
401#define NVTX_IMPL_GUARD_SYNC /* Ensure other headers cannot be included directly */
402#include "nvtxDetail/nvtxImplSync_v3.h"
403#undef NVTX_IMPL_GUARD_SYNC
404#endif /*NVTX_NO_IMPL*/
405
406#endif /* NVTOOLSEXT_SYNC_V3 */
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...
enum nvtxResourceSyncLinuxType_t nvtxResourceSyncAndroidType_t
Resource type values for Android come from Linux.
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 . .
nvtxResourceSyncLinuxType_t
Resource type values for Linux and Linux derived OSs such as Android.
nvtxResourceSyncPosixThreadType_t
Resource type values for OSs with POSIX Thread API support.
nvtxResourceSyncWindowsType_t
Resource type values for Windows OSs.
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...
User Defined Synchronization Object Attributes Structure. .
uint16_t version
Version flag of the structure.
int32_t messageType
Message type specified in this attribute structure.
uint16_t size
Size of the structure.
nvtxMessageValue_t message
Message assigned to this attribute structure.