Profiler.h
Go to the documentation of this file.
1 /* ========================================================================
2 * PROJECT: ARToolKitPlus
3 * ========================================================================
4 * This work is based on the original ARToolKit developed by
5 * Hirokazu Kato
6 * Mark Billinghurst
7 * HITLab, University of Washington, Seattle
8 * http://www.hitl.washington.edu/artoolkit/
9 *
10 * Copyright of the derived and new portions of this work
11 * (C) 2006 Graz University of Technology
12 *
13 * This framework is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This framework is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this framework; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 *
27 * For further information please contact
28 * Dieter Schmalstieg
29 * <schmalstieg@icg.tu-graz.ac.at>
30 * Graz University of Technology,
31 * Institut for Computer Graphics and Vision,
32 * Inffeldgasse 16a, 8010 Graz, Austria.
33 * ========================================================================
34 ** @author Daniel Wagner
35 *
36 * $Id: Profiler.h 162 2006-04-19 21:28:10Z grabner $
37 * @file
38 * ======================================================================== */
39 
40 
41 #ifndef __ARTOOLKITPLUS_PROFILER_HEADERFILE__
42 #define __ARTOOLKITPLUS_PROFILER_HEADERFILE__
43 
44 
45 #if defined(WIN32) || defined(_WIN32_WCE)
46 # define _ARTKP_IS_WINDOWS_
47 #endif
48 
49 
50 #ifdef _ARTKP_IS_WINDOWS_
51 # include <windows.h>
52 #endif
53 
54 
55 namespace ARToolKitPlus {
56 
57 
58 class Profiler
59 {
60 public:
61  enum MES {
66 
75 
77  };
78 
79  struct Measurement {
80 #ifdef _ARTKP_IS_WINDOWS_
81  LARGE_INTEGER secBegin, secEnd, sum;
82 #endif
83  void reset();
84  };
85 
89 
90  void reset();
91  void beginSection(Measurement& nM);
92  void endSection(Measurement& nM);
93 
94  float getFraction(const Measurement& nNom, const Measurement& nDenom) const;
95  float getFraction(MES nNom, MES nDenom) const;
96  float getTime(MES nMes) const;
97 
98  void writeReport(const char* nFileName, unsigned int nNumRuns=1) const;
99 
100  static bool isProfilingEnabled();
101 
102 protected:
103  const Measurement* getMes(MES nMes) const;
104 };
105 
106 
107 } // namespace ARToolKitPlus
108 
109 
110 //
111 // we use macros to simplify calls to the profiler
112 // and to turn profiling on/off
113 // define _USE_PROFILING_ in the project settings
114 // to activate profiling. note that this can reduce
115 // overall performance a lot when used too deeply
116 //
117 #ifdef _USE_PROFILING_
118  #define PROFILE_BEGINSEC(obj, mes) obj.beginSection(obj._##mes);
119  #define PROFILE_ENDSEC(obj, mes) obj.endSection(obj._##mes);
120 
121  #define PROFILEPTR_BEGINSEC(obj, mes) if(obj) obj->beginSection(obj->_##mes);
122  #define PROFILEPTR_ENDSEC(obj, mes) if(obj) obj->endSection(obj->_##mes);
123 #else
124  #define PROFILE_BEGINSEC(obj, mes);
125  #define PROFILE_ENDSEC(obj, mes);
126 
127  #define PROFILEPTR_BEGINSEC(obj, mes)
128  #define PROFILEPTR_ENDSEC(obj, mes)
129 #endif //_USE_PROFILING_
130 
131 
132 #endif //__ARTOOLKITPLUS_PROFILER_HEADERFILE__
Measurement _GETANGLE
Definition: Profiler.h:86
Measurement _MODIFYMATRIX
Definition: Profiler.h:86
float getFraction(const Measurement &nNom, const Measurement &nDenom) const
void endSection(Measurement &nM)
Definition: Profiler.cpp:164
Measurement _SINGLEMARKER_OVERALL
Definition: Profiler.h:86
float getTime(MES nMes) const
Definition: Profiler.cpp:177
This file should only be compiled when using ARToolKitPlus as a DLL.
Definition: ar.h:60
Measurement _LABELING
Definition: Profiler.h:86
Measurement _GETNEWMATRIX
Definition: Profiler.h:86
static bool isProfilingEnabled()
Definition: Profiler.cpp:230
Measurement _GETROT
Definition: Profiler.h:86
Measurement _MODIFYMATRIX_LOOP
Definition: Profiler.h:86
void beginSection(Measurement &nM)
Definition: Profiler.cpp:158
Measurement _DETECTMARKER2
Definition: Profiler.h:86
Measurement _GETTRANSMAT
Definition: Profiler.h:86
Measurement _GETTRANSMATSUB
Definition: Profiler.h:86
Measurement _GETTRANSMAT3
Definition: Profiler.h:86
Measurement _GETINITROT
Definition: Profiler.h:86
Measurement _GETMARKERINFO
Definition: Profiler.h:86
void writeReport(const char *nFileName, unsigned int nNumRuns=1) const
Definition: Profiler.cpp:188
const Measurement * getMes(MES nMes) const
Definition: Profiler.cpp:42


tuw_artoolkitplus
Author(s): Markus Bader
autogenerated on Sun Sep 4 2016 03:24:33