OpenNI 1.5.4
XnProfiling.h
Go to the documentation of this file.
1/****************************************************************************
2* *
3* OpenNI 1.x Alpha *
4* Copyright (C) 2011 PrimeSense Ltd. *
5* *
6* This file is part of OpenNI. *
7* *
8* OpenNI is free software: you can redistribute it and/or modify *
9* it under the terms of the GNU Lesser General Public License as published *
10* by the Free Software Foundation, either version 3 of the License, or *
11* (at your option) any later version. *
12* *
13* OpenNI is distributed in the hope that it will be useful, *
14* but WITHOUT ANY WARRANTY; without even the implied warranty of *
15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16* GNU Lesser General Public License for more details. *
17* *
18* You should have received a copy of the GNU Lesser General Public License *
19* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
20* *
21****************************************************************************/
22#ifndef _XN_PROFILING_H_
23#define _XN_PROFILING_H_
24
25//---------------------------------------------------------------------------
26// Includes
27//---------------------------------------------------------------------------
28#include <XnOS.h>
29
30//---------------------------------------------------------------------------
31// Defines
32//---------------------------------------------------------------------------
33#define INVALID_PROFILING_HANDLE -1
34
35//---------------------------------------------------------------------------
36// Types
37//---------------------------------------------------------------------------
38typedef XnInt32 XnProfilingHandle;
39
40//---------------------------------------------------------------------------
41// Exported Function Declaration
42//---------------------------------------------------------------------------
43
50XN_C_API XnStatus XN_C_DECL xnProfilingInit(XnUInt32 nProfilingInterval = 0);
51
58XN_C_API XnStatus XN_C_DECL xnProfilingInitFromINI(const XnChar* cpINIFileName, const XnChar* cpSectionName);
59
64
68XN_C_API XnBool XN_C_DECL xnProfilingIsActive();
69
78XN_C_API XnStatus XN_C_DECL xnProfilingSectionStart(const char* csSectionName, XnBool bMT, XnProfilingHandle* pHandle);
79
87
88
96#define _XN_PROFILING_START_SECTION(name, mt) \
97 { \
98 static XnProfilingHandle __profiling = INVALID_PROFILING_HANDLE; \
99 if (xnProfilingIsActive()) \
100 { \
101 xnProfilingSectionStart(name, mt, &__profiling); \
102 }
103
104#define XN_PROFILING_START_SECTION(name) _XN_PROFILING_START_SECTION(name, FALSE)
105#define XN_PROFILING_START_MT_SECTION(name) _XN_PROFILING_START_SECTION(name, TRUE)
106
110#define XN_PROFILING_END_SECTION \
111 if (__profiling != INVALID_PROFILING_HANDLE) \
112 { \
113 xnProfilingSectionEnd(&__profiling); \
114 } \
115 }
116
124#define XN_PROFILING_START_FUNCTION XN_PROFILING_START_SECTION(__FUNCTION__)
125
129#define XN_PROFILING_END_FUNCTION XN_PROFILING_END_SECTION
130
131#endif //_XN_PROFILING_H_
#define XN_C_API
Definition: XnPlatform.h:129
XN_C_API XnStatus XN_C_DECL xnProfilingSectionStart(const char *csSectionName, XnBool bMT, XnProfilingHandle *pHandle)
XN_C_API XnStatus XN_C_DECL xnProfilingInitFromINI(const XnChar *cpINIFileName, const XnChar *cpSectionName)
XN_C_API XnBool XN_C_DECL xnProfilingIsActive()
XnInt32 XnProfilingHandle
Definition: XnProfiling.h:38
XN_C_API XnStatus XN_C_DECL xnProfilingInit(XnUInt32 nProfilingInterval=0)
XN_C_API XnStatus XN_C_DECL xnProfilingSectionEnd(XnProfilingHandle *pHandle)
XN_C_API XnStatus XN_C_DECL xnProfilingShutdown()
XnUInt32 XnStatus
Definition: XnStatus.h:34