00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _XN_PROFILING_H_
00023 #define _XN_PROFILING_H_
00024
00025
00026
00027
00028 #include <XnOS.h>
00029
00030
00031
00032
00033 #define INVALID_PROFILING_HANDLE -1
00034
00035
00036
00037
00038 typedef XnInt32 XnProfilingHandle;
00039
00040
00041
00042
00043
00050 XN_C_API XnStatus XN_C_DECL xnProfilingInit(XnUInt32 nProfilingInterval = 0);
00051
00058 XN_C_API XnStatus XN_C_DECL xnProfilingInitFromINI(const XnChar* cpINIFileName, const XnChar* cpSectionName);
00059
00063 XN_C_API XnStatus XN_C_DECL xnProfilingShutdown();
00064
00068 XN_C_API XnBool XN_C_DECL xnProfilingIsActive();
00069
00078 XN_C_API XnStatus XN_C_DECL xnProfilingSectionStart(const char* csSectionName, XnBool bMT, XnProfilingHandle* pHandle);
00079
00086 XN_C_API XnStatus XN_C_DECL xnProfilingSectionEnd(XnProfilingHandle* pHandle);
00087
00088
00096 #define _XN_PROFILING_START_SECTION(name, mt) \
00097 { \
00098 static XnProfilingHandle __profiling = INVALID_PROFILING_HANDLE; \
00099 if (xnProfilingIsActive()) \
00100 { \
00101 xnProfilingSectionStart(name, mt, &__profiling); \
00102 }
00103
00104 #define XN_PROFILING_START_SECTION(name) _XN_PROFILING_START_SECTION(name, FALSE)
00105 #define XN_PROFILING_START_MT_SECTION(name) _XN_PROFILING_START_SECTION(name, TRUE)
00106
00110 #define XN_PROFILING_END_SECTION \
00111 if (__profiling != INVALID_PROFILING_HANDLE) \
00112 { \
00113 xnProfilingSectionEnd(&__profiling); \
00114 } \
00115 }
00116
00124 #define XN_PROFILING_START_FUNCTION XN_PROFILING_START_SECTION(__FUNCTION__)
00125
00129 #define XN_PROFILING_END_FUNCTION XN_PROFILING_END_SECTION
00130
00131 #endif //_XN_PROFILING_H_