OpenNI 1.0.0
|
00001 /***************************************************************************** 00002 * * 00003 * OpenNI 1.0 Alpha * 00004 * Copyright (C) 2010 PrimeSense Ltd. * 00005 * * 00006 * This file is part of OpenNI. * 00007 * * 00008 * OpenNI is free software: you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published * 00010 * by the Free Software Foundation, either version 3 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * OpenNI is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with OpenNI. If not, see <http://www.gnu.org/licenses/>. * 00020 * * 00021 *****************************************************************************/ 00022 00023 00024 00025 00026 #ifndef _XN_PROFILING_H_ 00027 #define _XN_PROFILING_H_ 00028 00029 //--------------------------------------------------------------------------- 00030 // Includes 00031 //--------------------------------------------------------------------------- 00032 #include <XnOS.h> 00033 00034 //--------------------------------------------------------------------------- 00035 // Defines 00036 //--------------------------------------------------------------------------- 00037 #define INVALID_PROFILING_HANDLE -1 00038 00039 //--------------------------------------------------------------------------- 00040 // Types 00041 //--------------------------------------------------------------------------- 00042 typedef XnInt32 XnProfilingHandle; 00043 00044 //--------------------------------------------------------------------------- 00045 // Exported Function Declaration 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_