Main Page Class List Class Members

NvBlastProfilerInternal.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27
28
29 #ifndef NVBLASTPROFILERINTERNAL_H
30 #define NVBLASTPROFILERINTERNAL_H
31
32 #include "NvBlastPreprocessor.h"
33 #include "NvBlastProfiler.h"
34
35 #if NV_PROFILE || NV_CHECKED || NV_DEBUG
36
37 NVBLAST_API void NvBlastProfilerBegin(const char* name, Nv::Blast::ProfilerDetail::Level);
38 NVBLAST_API void NvBlastProfilerEnd(const void* name, Nv::Blast::ProfilerDetail::Level);
39
40 Nv::Blast::ProfilerCallback* NvBlastProfilerGetCallback();
41 Nv::Blast::ProfilerDetail::Level NvBlastProfilerGetDetail();
42
43
44 namespace Nv
45 {
46 namespace Blast
47 {
48
49
50 class ProfileScope
51 {
52 public:
53 ProfileScope(const char* name, ProfilerDetail::Level level) :m_name(name), m_level(level)
54 {
55 NvBlastProfilerBegin(m_name, m_level);
56 }
57
58 ~ProfileScope()
59 {
60 NvBlastProfilerEnd(m_name, m_level);
61 }
62
63 private:
64 const char* m_name;
65 ProfilerDetail::Level m_level;
66 };
67
68
69 } // namespace Blast
70 } // namespace Nv
71
72
73 #define BLAST_PROFILE_PREFIX "Blast: "
74 #define BLAST_PROFILE_ZONE_BEGIN(name) NvBlastProfilerBegin(BLAST_PROFILE_PREFIX name, Nv::Blast::ProfilerDetail::HIGH)
75 #define BLAST_PROFILE_ZONE_END(name) NvBlastProfilerEnd(BLAST_PROFILE_PREFIX name, Nv::Blast::ProfilerDetail::HIGH)
76 #define BLAST_PROFILE_SCOPE(name, detail) Nv::Blast::ProfileScope NV_CONCAT(_scope,__LINE__) (BLAST_PROFILE_PREFIX name, detail)
77 #define BLAST_PROFILE_SCOPE_L(name) BLAST_PROFILE_SCOPE(name, Nv::Blast::ProfilerDetail::LOW)
78 #define BLAST_PROFILE_SCOPE_M(name) BLAST_PROFILE_SCOPE(name, Nv::Blast::ProfilerDetail::MEDIUM)
79 #define BLAST_PROFILE_SCOPE_H(name) BLAST_PROFILE_SCOPE(name, Nv::Blast::ProfilerDetail::HIGH)
80
81 #else
82
83 #define BLAST_PROFILE_ZONE_BEGIN(name)
84 #define BLAST_PROFILE_ZONE_END(name)
85 #define BLAST_PROFILE_SCOPE_L(name)
86 #define BLAST_PROFILE_SCOPE_M(name)
87 #define BLAST_PROFILE_SCOPE_H(name)
88
89 #endif
90
91 #endif
Nv::Blast::ProfilerDetail::Level
Level
Definition: NvBlastProfiler.h:67
NVBLAST_API
#define NVBLAST_API
Definition: NvBlastPreprocessor.h:37
Nv::Blast::ProfilerCallback
Definition: NvBlastProfiler.h:44
Nv
Definition: NvBlastArray.h:37
NvBlastPreprocessor.h
NvBlastProfiler.h