OpenNI 1.5.4: XnProfiling.h Source File

OpenNI

OpenNI 1.5.4
XnProfiling.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 *                                                                           *
00003 *  OpenNI 1.x Alpha                                                         *
00004 *  Copyright (C) 2011 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 #ifndef _XN_PROFILING_H_
00023 #define _XN_PROFILING_H_
00024 
00025 //---------------------------------------------------------------------------
00026 // Includes
00027 //---------------------------------------------------------------------------
00028 #include <XnOS.h>
00029 
00030 //---------------------------------------------------------------------------
00031 // Defines
00032 //---------------------------------------------------------------------------
00033 #define INVALID_PROFILING_HANDLE    -1
00034 
00035 //---------------------------------------------------------------------------
00036 // Types
00037 //---------------------------------------------------------------------------
00038 typedef XnInt32 XnProfilingHandle;
00039 
00040 //---------------------------------------------------------------------------
00041 // Exported Function Declaration
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_
Generated on Wed May 16 2012 10:16:05 for OpenNI 1.5.4 by   doxygen 1.7.5.1