go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxTimer.h
Go to the documentation of this file.
1 /*======================================================================
2 
3  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 #ifndef __elxTimer_H_
15 #define __elxTimer_H_
16 
17 #include "itkObject.h"
18 #include "itkObjectFactory.h"
19 #include <ctime>
20 #include <sstream>
21 
44 namespace tmr
45 {
46 using namespace itk;
47 
67 class Timer : public Object
68 {
69 public:
71  typedef Timer Self;
72  typedef Object Superclass;
73  typedef SmartPointer<Self> Pointer;
74  typedef SmartPointer<const Self> ConstPointer;
75 
77  itkNewMacro( Self );
78 
80  itkTypeMacro( Timer, Object );
81 
83  typedef std::vector<std::size_t> TimeDHMSType;
84 
86  void StartTimer( void );
87  int StopTimer( void );
88  int ElapsedClockAndTime( void );
89 
93  const std::string & PrintStartTime( void );
94  const std::string & PrintStopTime( void );
95  const std::string & PrintElapsedTimeDHMS( void );
96  const std::string & PrintElapsedTimeSec( void );
97  const std::string & PrintElapsedClock( void );
98  const std::string & PrintElapsedClockSec( void );
99 
101  itkGetConstMacro( StartTime, time_t );
102  itkGetConstMacro( StopTime, time_t );
103  itkGetConstMacro( ElapsedTime, double );
104  // itkGetConstMacro( ElapsedTimeDHMS, TimeDHMSType );
105  itkGetConstMacro( ElapsedTimeSec, std::size_t );
106  itkGetConstMacro( ElapsedClock, double );
107  itkGetConstMacro( ElapsedClockSec, double );
108 
109 protected:
110 
111  Timer();
112  virtual ~Timer(){};
113 
115  time_t m_StartTime;
116  clock_t m_StartClock;
117  time_t m_StopTime;
118  clock_t m_StopClock;
120  clock_t m_ElapsedClock;
122  std::size_t m_ElapsedTimeSec;
124 
126 #if defined( __GNUC__ ) && !defined( __APPLE__ )
127 #define ELX_USE_CLOCK_GETTIME
128  struct timespec m_StartClockMonotonic;
129  struct timespec m_StopClockMonotonic;
130 #endif
131 
133  std::string m_StartTimeString;
134  std::string m_StopTimeString;
137  std::string m_ElapsedClockString;
139 
140 private:
141 
142  Timer( const Self& ); // purposely not implemented
143  void operator=( const Self& ); // purposely not implemented
144 
145 }; // end class Timer
146 
147 
148 } // end namespace tmr
149 
150 
151 #endif // end #ifndef __elxTimer_H_
clock_t m_StopClock
Definition: elxTimer.h:118
double m_ElapsedClockSec
Definition: elxTimer.h:123
SmartPointer< const Self > ConstPointer
Definition: elxTimer.h:74
Timer Self
Definition: elxTimer.h:71
TimeDHMSType m_ElapsedTimeDHMS
Definition: elxTimer.h:121
virtual ~Timer()
Definition: elxTimer.h:112
SmartPointer< Self > Pointer
Definition: elxTimer.h:73
double m_ElapsedTime
Definition: elxTimer.h:119
clock_t m_StartClock
Definition: elxTimer.h:116
std::string m_ElapsedClockSecString
Definition: elxTimer.h:138
Object Superclass
Definition: elxTimer.h:72
time_t m_StopTime
Definition: elxTimer.h:117
A class to time the different parts of the registration.
Definition: elxTimer.h:67
std::string m_ElapsedTimeDHMSString
Definition: elxTimer.h:135
std::string m_StartTimeString
Definition: elxTimer.h:133
clock_t m_ElapsedClock
Definition: elxTimer.h:120
std::vector< std::vcl_size_t > TimeDHMSType
Definition: elxTimer.h:80
std::string m_ElapsedTimeSecString
Definition: elxTimer.h:136
std::vcl_size_t m_ElapsedTimeSec
Definition: elxTimer.h:122
std::string m_StopTimeString
Definition: elxTimer.h:134
std::string m_ElapsedClockString
Definition: elxTimer.h:137


Generated on 06-12-2013 for elastix by doxygen 1.8.5 elastix logo