![]() |
OpenNI 1.5.7
|
00001 /***************************************************************************** 00002 * * 00003 * OpenNI 1.x Alpha * 00004 * Copyright (C) 2012 PrimeSense Ltd. * 00005 * * 00006 * This file is part of OpenNI. * 00007 * * 00008 * Licensed under the Apache License, Version 2.0 (the "License"); * 00009 * you may not use this file except in compliance with the License. * 00010 * You may obtain a copy of the License at * 00011 * * 00012 * http://www.apache.org/licenses/LICENSE-2.0 * 00013 * * 00014 * Unless required by applicable law or agreed to in writing, software * 00015 * distributed under the License is distributed on an "AS IS" BASIS, * 00016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 00017 * See the License for the specific language governing permissions and * 00018 * limitations under the License. * 00019 * * 00020 *****************************************************************************/ 00021 #ifndef _XN_PROFILING_H_ 00022 #define _XN_PROFILING_H_ 00023 00024 //--------------------------------------------------------------------------- 00025 // Includes 00026 //--------------------------------------------------------------------------- 00027 #include <XnOS.h> 00028 00029 //--------------------------------------------------------------------------- 00030 // Defines 00031 //--------------------------------------------------------------------------- 00032 #define INVALID_PROFILING_HANDLE -1 00033 00034 //--------------------------------------------------------------------------- 00035 // Types 00036 //--------------------------------------------------------------------------- 00037 typedef XnInt32 XnProfilingHandle; 00038 00039 //--------------------------------------------------------------------------- 00040 // Exported Function Declaration 00041 //--------------------------------------------------------------------------- 00042 00049 XN_C_API XnStatus XN_C_DECL xnProfilingInit(XnUInt32 nProfilingInterval = 0); 00050 00057 XN_C_API XnStatus XN_C_DECL xnProfilingInitFromINI(const XnChar* cpINIFileName, const XnChar* cpSectionName); 00058 00062 XN_C_API XnStatus XN_C_DECL xnProfilingShutdown(); 00063 00067 XN_C_API XnBool XN_C_DECL xnProfilingIsActive(); 00068 00077 XN_C_API XnStatus XN_C_DECL xnProfilingSectionStart(const char* csSectionName, XnBool bMT, XnProfilingHandle* pHandle); 00078 00085 XN_C_API XnStatus XN_C_DECL xnProfilingSectionEnd(XnProfilingHandle* pHandle); 00086 00087 00095 #define _XN_PROFILING_START_SECTION(name, mt) \ 00096 { \ 00097 static XnProfilingHandle __profiling = INVALID_PROFILING_HANDLE; \ 00098 if (xnProfilingIsActive()) \ 00099 { \ 00100 xnProfilingSectionStart(name, mt, &__profiling); \ 00101 } 00102 00103 #define XN_PROFILING_START_SECTION(name) _XN_PROFILING_START_SECTION(name, FALSE) 00104 #define XN_PROFILING_START_MT_SECTION(name) _XN_PROFILING_START_SECTION(name, TRUE) 00105 00109 #define XN_PROFILING_END_SECTION \ 00110 if (__profiling != INVALID_PROFILING_HANDLE) \ 00111 { \ 00112 xnProfilingSectionEnd(&__profiling); \ 00113 } \ 00114 } 00115 00123 #define XN_PROFILING_START_FUNCTION XN_PROFILING_START_SECTION(__FUNCTION__) 00124 00128 #define XN_PROFILING_END_FUNCTION XN_PROFILING_END_SECTION 00129 00130 #endif //_XN_PROFILING_H_