Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:45:12

0001 /*
0002  * SPDX-FileCopyrightText: Copyright (c) 2009-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
0003  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0004  *
0005  * Licensed under the Apache License, Version 2.0 (the "License");
0006  * you may not use this file except in compliance with the License.
0007  * You may obtain a copy of the License at
0008  *
0009  *     http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  *
0017  * Licensed under the Apache License v2.0 with LLVM Exceptions.
0018  * See https://nvidia.github.io/NVTX/LICENSE.txt for license information.
0019  */
0020 
0021 #ifndef NVTX_EXT_IMPL_GUARD
0022 #error Never include this file directly -- it is automatically included by nvToolsExt.h (except when NVTX_NO_IMPL is defined).
0023 #endif
0024 
0025 #if defined(NVTX_AS_SYSTEM_HEADER)
0026 #if defined(__clang__)
0027 #pragma clang system_header
0028 #elif defined(__GNUC__) || defined(__NVCOMPILER)
0029 #pragma GCC system_header
0030 #elif defined(_MSC_VER)
0031 #pragma system_header
0032 #endif
0033 #endif
0034 
0035 #ifndef NVTX_EXT_IMPL_H
0036 #define NVTX_EXT_IMPL_H
0037 
0038 #include <stdlib.h>
0039 #include <stdio.h>
0040 #include <string.h>
0041 #include <wchar.h>
0042 
0043 /* ---- Include required platform headers ---- */
0044 
0045 #if defined(_WIN32)
0046 
0047 #include <windows.h>
0048 
0049 #else
0050 #include <unistd.h>
0051 
0052 #if defined(__ANDROID__)
0053 #include <android/api-level.h>
0054 #endif
0055 
0056 #if defined(__linux__) || defined(__CYGWIN__)
0057 #include <sched.h>
0058 #endif
0059 
0060 #include <sys/types.h>
0061 #include <limits.h>
0062 #include <dlfcn.h>
0063 #include <fcntl.h>
0064 #include <errno.h>
0065 #include <pthread.h>
0066 
0067 #endif
0068 
0069 /* ---- Define macros used in this file ---- */
0070 
0071 #ifdef NVTX_DEBUG_PRINT
0072 #ifdef __ANDROID__
0073 #include <android/log.h>
0074 #define NVTX_ERR(...) __android_log_print(ANDROID_LOG_ERROR, "NVTOOLSEXT", __VA_ARGS__);
0075 #define NVTX_INFO(...) __android_log_print(ANDROID_LOG_INFO, "NVTOOLSEXT", __VA_ARGS__);
0076 #else
0077 #include <stdio.h>
0078 #define NVTX_ERR(...) fprintf(stderr, "NVTX_ERROR: " __VA_ARGS__)
0079 #define NVTX_INFO(...) fprintf(stderr, "NVTX_INFO: " __VA_ARGS__)
0080 #endif
0081 #else /* !defined(NVTX_DEBUG_PRINT) */
0082 #define NVTX_ERR(...)
0083 #define NVTX_INFO(...)
0084 #endif
0085 
0086 #ifdef __cplusplus
0087 extern "C" {
0088 #endif /* __cplusplus */
0089 
0090 #ifdef __GNUC__
0091 #pragma GCC visibility push(hidden)
0092 #endif
0093 
0094 #define NVTX_EXTENSION_FRESH 0    /* Uninitialized extension or function slot */
0095 #define NVTX_EXTENSION_DISABLED 1 /* Disabled extension or function slot */
0096 #define NVTX_EXTENSION_STARTING 2 /* Extension is being initialized. */
0097 #define NVTX_EXTENSION_LOADED 3   /* Extension is initialized successfully. */
0098 #define NVTX_EXTENSION_INIT_FN_FAILED 4 /* Extension init function returned failure. */
0099 
0100 /* Function slots are local to each extension */
0101 typedef struct nvtxExtGlobals1_t
0102 {
0103     NvtxExtInitializeInjectionFunc_t injectionFnPtr;
0104 } nvtxExtGlobals1_t;
0105 
0106 NVTX_LINKONCE_DEFINE_GLOBAL nvtxExtGlobals1_t NVTX_VERSIONED_IDENTIFIER(nvtxExtGlobals1) =
0107 {
0108     NVTX_NULLPTR
0109 };
0110 
0111 #define NVTX_EXT_INIT_GUARD
0112 #include "nvtxExtInit.h"
0113 #undef NVTX_EXT_INIT_GUARD
0114 
0115 #ifdef __GNUC__
0116 #pragma GCC visibility pop
0117 #endif
0118 
0119 #ifdef __cplusplus
0120 } /* extern "C" */
0121 #endif /* __cplusplus */
0122 
0123 #endif /* NVTX_EXT_IMPL_H */