Go to the documentation of this file.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 #ifndef _XN_PROFILING_H_
00027 #define _XN_PROFILING_H_
00028
00029
00030
00031
00032 #include <XnOS.h>
00033
00034
00035
00036
00037 #define INVALID_PROFILING_HANDLE -1
00038
00039
00040
00041
00042 typedef XnInt32 XnProfilingHandle;
00043
00044
00045
00046
00047
00054 XN_C_API XnStatus xnProfilingInit(XnUInt32 nProfilingInterval = 0);
00055
00062 XN_C_API XnStatus xnProfilingInitFromINI(const XnChar* cpINIFileName, const XnChar* cpSectionName);
00063
00067 XN_C_API XnStatus xnProfilingShutdown();
00068
00072 XN_C_API XnBool xnProfilingIsActive();
00073
00082 XN_C_API XnStatus xnProfilingSectionStart(const char* csSectionName, XnBool bMT, XnProfilingHandle* pHandle);
00083
00090 XN_C_API XnStatus xnProfilingSectionEnd(XnProfilingHandle* pHandle);
00091
00092
00100 #define _XN_PROFILING_START_SECTION(name, mt) \
00101 { \
00102 static XnProfilingHandle __profiling = INVALID_PROFILING_HANDLE; \
00103 if (xnProfilingIsActive()) \
00104 { \
00105 xnProfilingSectionStart(name, mt, &__profiling); \
00106 }
00107
00108 #define XN_PROFILING_START_SECTION(name) _XN_PROFILING_START_SECTION(name, FALSE)
00109 #define XN_PROFILING_START_MT_SECTION(name) _XN_PROFILING_START_SECTION(name, TRUE)
00110
00114 #define XN_PROFILING_END_SECTION \
00115 if (__profiling != INVALID_PROFILING_HANDLE) \
00116 { \
00117 xnProfilingSectionEnd(&__profiling); \
00118 } \
00119 }
00120
00128 #define XN_PROFILING_START_FUNCTION XN_PROFILING_START_SECTION(__FUNCTION__)
00129
00133 #define XN_PROFILING_END_FUNCTION XN_PROFILING_END_SECTION
00134
00135 #endif //_XN_PROFILING_H_