OpenNI 1.5.7
XnProfiling.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * *
3 * OpenNI 1.x Alpha *
4 * Copyright (C) 2012 PrimeSense Ltd. *
5 * *
6 * This file is part of OpenNI. *
7 * *
8 * Licensed under the Apache License, Version 2.0 (the "License"); *
9 * you may not use this file except in compliance with the License. *
10 * You may obtain a copy of the License at *
11 * *
12 * http://www.apache.org/licenses/LICENSE-2.0 *
13 * *
14 * Unless required by applicable law or agreed to in writing, software *
15 * distributed under the License is distributed on an "AS IS" BASIS, *
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17 * See the License for the specific language governing permissions and *
18 * limitations under the License. *
19 * *
20 *****************************************************************************/
21 #ifndef _XN_PROFILING_H_
22 #define _XN_PROFILING_H_
23 
24 //---------------------------------------------------------------------------
25 // Includes
26 //---------------------------------------------------------------------------
27 #include <XnOS.h>
28 
29 //---------------------------------------------------------------------------
30 // Defines
31 //---------------------------------------------------------------------------
32 #define INVALID_PROFILING_HANDLE -1
33 
34 //---------------------------------------------------------------------------
35 // Types
36 //---------------------------------------------------------------------------
37 typedef XnInt32 XnProfilingHandle;
38 
39 //---------------------------------------------------------------------------
40 // Exported Function Declaration
41 //---------------------------------------------------------------------------
42 
49 XN_C_API XnStatus XN_C_DECL xnProfilingInit(XnUInt32 nProfilingInterval = 0);
50 
57 XN_C_API XnStatus XN_C_DECL xnProfilingInitFromINI(const XnChar* cpINIFileName, const XnChar* cpSectionName);
58 
63 
67 XN_C_API XnBool XN_C_DECL xnProfilingIsActive();
68 
77 XN_C_API XnStatus XN_C_DECL xnProfilingSectionStart(const char* csSectionName, XnBool bMT, XnProfilingHandle* pHandle);
78 
86 
87 
95 #define _XN_PROFILING_START_SECTION(name, mt) \
96  { \
97  static XnProfilingHandle __profiling = INVALID_PROFILING_HANDLE; \
98  if (xnProfilingIsActive()) \
99  { \
100  xnProfilingSectionStart(name, mt, &__profiling); \
101  }
102 
103 #define XN_PROFILING_START_SECTION(name) _XN_PROFILING_START_SECTION(name, FALSE)
104 #define XN_PROFILING_START_MT_SECTION(name) _XN_PROFILING_START_SECTION(name, TRUE)
105 
109 #define XN_PROFILING_END_SECTION \
110  if (__profiling != INVALID_PROFILING_HANDLE) \
111  { \
112  xnProfilingSectionEnd(&__profiling); \
113  } \
114  }
115 
123 #define XN_PROFILING_START_FUNCTION XN_PROFILING_START_SECTION(__FUNCTION__)
124 
128 #define XN_PROFILING_END_FUNCTION XN_PROFILING_END_SECTION
129 
130 #endif //_XN_PROFILING_H_
XnOS.h
XN_C_API
#define XN_C_API
Definition: XnPlatform.h:121
XnStatus
XnUInt32 XnStatus
Definition: XnStatus.h:33
xnProfilingInitFromINI
XN_C_API XnStatus XN_C_DECL xnProfilingInitFromINI(const XnChar *cpINIFileName, const XnChar *cpSectionName)
XnProfilingHandle
XnInt32 XnProfilingHandle
Definition: XnProfiling.h:37
xnProfilingSectionStart
XN_C_API XnStatus XN_C_DECL xnProfilingSectionStart(const char *csSectionName, XnBool bMT, XnProfilingHandle *pHandle)
xnProfilingShutdown
XN_C_API XnStatus XN_C_DECL xnProfilingShutdown()
xnProfilingInit
XN_C_API XnStatus XN_C_DECL xnProfilingInit(XnUInt32 nProfilingInterval=0)
xnProfilingIsActive
XN_C_API XnBool XN_C_DECL xnProfilingIsActive()
xnProfilingSectionEnd
XN_C_API XnStatus XN_C_DECL xnProfilingSectionEnd(XnProfilingHandle *pHandle)