00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef NVBLASTPROFILERINTERNAL_H
00030 #define NVBLASTPROFILERINTERNAL_H
00031
00032 #include "NvBlastPreprocessor.h"
00033 #include "NvBlastProfiler.h"
00034
00035 #if NV_PROFILE || NV_CHECKED || NV_DEBUG
00036
00037 NVBLAST_API void NvBlastProfilerBegin(const char* name, Nv::Blast::ProfilerDetail::Level);
00038 NVBLAST_API void NvBlastProfilerEnd(const void* name, Nv::Blast::ProfilerDetail::Level);
00039
00040 Nv::Blast::ProfilerCallback* NvBlastProfilerGetCallback();
00041 Nv::Blast::ProfilerDetail::Level NvBlastProfilerGetDetail();
00042
00043
00044 namespace Nv
00045 {
00046 namespace Blast
00047 {
00048
00049
00050 class ProfileScope
00051 {
00052 public:
00053 ProfileScope(const char* name, ProfilerDetail::Level level) :m_name(name), m_level(level)
00054 {
00055 NvBlastProfilerBegin(m_name, m_level);
00056 }
00057
00058 ~ProfileScope()
00059 {
00060 NvBlastProfilerEnd(m_name, m_level);
00061 }
00062
00063 private:
00064 const char* m_name;
00065 ProfilerDetail::Level m_level;
00066 };
00067
00068
00069 }
00070 }
00071
00072
00073 #define BLAST_PROFILE_PREFIX "Blast: "
00074 #define BLAST_PROFILE_ZONE_BEGIN(name) NvBlastProfilerBegin(BLAST_PROFILE_PREFIX name, Nv::Blast::ProfilerDetail::HIGH)
00075 #define BLAST_PROFILE_ZONE_END(name) NvBlastProfilerEnd(BLAST_PROFILE_PREFIX name, Nv::Blast::ProfilerDetail::HIGH)
00076 #define BLAST_PROFILE_SCOPE(name, detail) Nv::Blast::ProfileScope NV_CONCAT(_scope,__LINE__) (BLAST_PROFILE_PREFIX name, detail)
00077 #define BLAST_PROFILE_SCOPE_L(name) BLAST_PROFILE_SCOPE(name, Nv::Blast::ProfilerDetail::LOW)
00078 #define BLAST_PROFILE_SCOPE_M(name) BLAST_PROFILE_SCOPE(name, Nv::Blast::ProfilerDetail::MEDIUM)
00079 #define BLAST_PROFILE_SCOPE_H(name) BLAST_PROFILE_SCOPE(name, Nv::Blast::ProfilerDetail::HIGH)
00080
00081 #else
00082
00083 #define BLAST_PROFILE_ZONE_BEGIN(name)
00084 #define BLAST_PROFILE_ZONE_END(name)
00085 #define BLAST_PROFILE_SCOPE_L(name)
00086 #define BLAST_PROFILE_SCOPE_M(name)
00087 #define BLAST_PROFILE_SCOPE_H(name)
00088
00089 #endif
00090
00091 #endif