NVTX C API Reference v3
NVIDIA Tools Extension Library
Loading...
Searching...
No Matches
nvToolsExtSync.h
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2009-2022 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 LICENSE.txt for license information.
19 */
20
21#include "nvToolsExt.h"
22
23#ifndef NVTOOLSEXT_SYNC_V3
24#define NVTOOLSEXT_SYNC_V3
25
26#ifdef __cplusplus
27extern "C" {
28#endif /* __cplusplus */
29
30/* \cond SHOW_HIDDEN
31* \version \NVTX_VERSION_2
32*/
33#define NVTX_SYNCUSER_ATTRIB_STRUCT_SIZE ( (uint16_t)( sizeof(nvtxSyncUserAttributes_v0) ) )
95/* ------------------------------------------------------------------------- */
96/* \cond SHOW_HIDDEN
97* \brief Used to build a non-colliding value for resource types separated class
98* \version \NVTX_VERSION_2
99*/
100#define NVTX_RESOURCE_CLASS_SYNC_OS 2
101#define NVTX_RESOURCE_CLASS_SYNC_PTHREAD 3
105/* ------------------------------------------------------------------------- */
114{
115 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_MUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 1), /* pthread_mutex_t */
116 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_CONDITION = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 2), /* pthread_cond_t */
117 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_RWLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 3), /* pthread_rwlock_t */
118 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_BARRIER = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 4), /* pthread_barrier_t */
119 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_SPINLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 5), /* pthread_spinlock_t */
120 NVTX_RESOURCE_TYPE_SYNC_PTHREAD_ONCE = NVTX_RESOURCE_MAKE_TYPE(SYNC_PTHREAD, 6) /* pthread_once_t */
122
126{
127 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_MUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 1),
128 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_SEMAPHORE = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 2),
129 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_EVENT = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 3),
130 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_CRITICAL_SECTION = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 4),
131 NVTX_RESOURCE_TYPE_SYNC_WINDOWS_SRWLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 5)
133
139{
140 NVTX_RESOURCE_TYPE_SYNC_LINUX_MUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 1),
141 NVTX_RESOURCE_TYPE_SYNC_LINUX_FUTEX = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 2),
142 NVTX_RESOURCE_TYPE_SYNC_LINUX_SEMAPHORE = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 3),
143 NVTX_RESOURCE_TYPE_SYNC_LINUX_COMPLETION = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 4),
144 NVTX_RESOURCE_TYPE_SYNC_LINUX_SPINLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 5),
145 NVTX_RESOURCE_TYPE_SYNC_LINUX_SEQLOCK = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 6),
146 NVTX_RESOURCE_TYPE_SYNC_LINUX_RCU = NVTX_RESOURCE_MAKE_TYPE(SYNC_OS, 7)
148
155
164typedef struct nvtxSyncUser* nvtxSyncUser_t;
165
236{
244 uint16_t version;
245
252 uint16_t size;
253
261 int32_t messageType; /* nvtxMessageType_t */
262
268
270
271typedef struct nvtxSyncUserAttributes_v0 nvtxSyncUserAttributes_t;
272
273/* ------------------------------------------------------------------------- */
292NVTX_DECLSPEC nvtxSyncUser_t NVTX_API nvtxDomainSyncUserCreate(nvtxDomainHandle_t domain, const nvtxSyncUserAttributes_t* attribs);
293
294/* ------------------------------------------------------------------------- */
310NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserDestroy(nvtxSyncUser_t handle);
311
312/* ------------------------------------------------------------------------- */
327NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireStart(nvtxSyncUser_t handle);
328
329/* ------------------------------------------------------------------------- */
NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireFailed(nvtxSyncUser_t handle);
345
346/* ------------------------------------------------------------------------- */
NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserAcquireSuccess(nvtxSyncUser_t handle);
362
363/* ------------------------------------------------------------------------- */
379NVTX_DECLSPEC void NVTX_API nvtxDomainSyncUserReleasing(nvtxSyncUser_t handle);
380
381
/*END defgroup*/
383
384#ifdef __cplusplus
385}
386#endif /* __cplusplus */
387
388#ifndef NVTX_NO_IMPL
389#define NVTX_IMPL_GUARD_SYNC /* Ensure other headers cannot be included directly */
390#include "nvtxDetail/nvtxImplSync_v3.h"
391#undef NVTX_IMPL_GUARD_SYNC
392#endif /*NVTX_NO_IMPL*/
393
394#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.