XnProfiling.h
Go to the documentation of this file.
/****************************************************************************
* *
* OpenNI 1.x Alpha *
* Copyright (C) 2011 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* OpenNI is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* OpenNI is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
* *
****************************************************************************/
#ifndef _XN_PROFILING_H_
#define _XN_PROFILING_H_
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include <XnOS.h>
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
#define INVALID_PROFILING_HANDLE -1
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
typedef XnInt32 XnProfilingHandle;
//---------------------------------------------------------------------------
// Exported Function Declaration
//---------------------------------------------------------------------------
XN_C_API XnStatus XN_C_DECL xnProfilingInit(XnUInt32 nProfilingInterval = 0);
XN_C_API XnStatus XN_C_DECL xnProfilingInitFromINI(const XnChar* cpINIFileName, const XnChar* cpSectionName);
XN_C_API XnStatus XN_C_DECL xnProfilingShutdown();
XN_C_API XnBool XN_C_DECL xnProfilingIsActive();
XN_C_API XnStatus XN_C_DECL xnProfilingSectionStart(const char* csSectionName, XnBool bMT, XnProfilingHandle* pHandle);
XN_C_API XnStatus XN_C_DECL xnProfilingSectionEnd(XnProfilingHandle* pHandle);
#define _XN_PROFILING_START_SECTION(name, mt) \
{ \
static XnProfilingHandle __profiling = INVALID_PROFILING_HANDLE; \
if (xnProfilingIsActive()) \
{ \
xnProfilingSectionStart(name, mt, &__profiling); \
}
#define XN_PROFILING_START_SECTION(name) _XN_PROFILING_START_SECTION(name, FALSE)
#define XN_PROFILING_START_MT_SECTION(name) _XN_PROFILING_START_SECTION(name, TRUE)
#define XN_PROFILING_END_SECTION \
if (__profiling != INVALID_PROFILING_HANDLE) \
{ \
xnProfilingSectionEnd(&__profiling); \
} \
}
#define XN_PROFILING_START_FUNCTION XN_PROFILING_START_SECTION(__FUNCTION__)
#define XN_PROFILING_END_FUNCTION XN_PROFILING_END_SECTION
#endif //_XN_PROFILING_H_
XnOS.h
XN_C_API
#define XN_C_API
Definition XnPlatform.h:132
xnProfilingSectionStart
XN_C_API XnStatus XN_C_DECL xnProfilingSectionStart(const char *csSectionName, XnBool bMT, XnProfilingHandle *pHandle)
xnProfilingInitFromINI
XN_C_API XnStatus XN_C_DECL xnProfilingInitFromINI(const XnChar *cpINIFileName, const XnChar *cpSectionName)
xnProfilingIsActive
XN_C_API XnBool XN_C_DECL xnProfilingIsActive()
XnProfilingHandle
XnInt32 XnProfilingHandle
Definition XnProfiling.h:38
xnProfilingInit
XN_C_API XnStatus XN_C_DECL xnProfilingInit(XnUInt32 nProfilingInterval=0)
xnProfilingSectionEnd
XN_C_API XnStatus XN_C_DECL xnProfilingSectionEnd(XnProfilingHandle *pHandle)
xnProfilingShutdown
XN_C_API XnStatus XN_C_DECL xnProfilingShutdown()
XnStatus
XnUInt32 XnStatus
Definition XnStatus.h:34