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 
66 class Timer : public itk::Object
67 {
68 public:
70  typedef Timer Self;
71  typedef itk::Object Superclass;
72  typedef itk::SmartPointer<Self> Pointer;
73  typedef itk::SmartPointer<const Self> ConstPointer;
74 
76  itkNewMacro( Self );
77 
79  itkTypeMacro( Timer, itk::Object );
80 
82  typedef std::vector<std::size_t> TimeDHMSType;
83 
85  void StartTimer( void );
86  int StopTimer( void );
87  int ElapsedClockAndTime( void );
88 
92  const std::string & PrintStartTime( void );
93  const std::string & PrintStopTime( void );
94  const std::string & PrintElapsedTimeDHMS( void );
95  const std::string & PrintElapsedTimeSec( void );
96  const std::string & PrintElapsedClock( void );
97  const std::string & PrintElapsedClockSec( void );
98 
100  itkGetConstMacro( StartTime, time_t );
101  itkGetConstMacro( StopTime, time_t );
102  itkGetConstMacro( ElapsedTime, double );
103  // itkGetConstMacro( ElapsedTimeDHMS, TimeDHMSType );
104  itkGetConstMacro( ElapsedTimeSec, std::size_t );
105  itkGetConstMacro( ElapsedClock, double );
106  itkGetConstMacro( ElapsedClockSec, double );
107 
108 protected:
109 
110  Timer();
111  virtual ~Timer(){};
112 
114  time_t m_StartTime;
115  clock_t m_StartClock;
116  time_t m_StopTime;
117  clock_t m_StopClock;
119  clock_t m_ElapsedClock;
121  std::size_t m_ElapsedTimeSec;
123 
125 #if defined( __GNUC__ ) && !defined( __APPLE__ )
126 #define ELX_USE_CLOCK_GETTIME
127  struct timespec m_StartClockMonotonic;
128  struct timespec m_StopClockMonotonic;
129 #endif
130 
132  std::string m_StartTimeString;
133  std::string m_StopTimeString;
136  std::string m_ElapsedClockString;
138 
139 private:
140 
141  Timer( const Self& ); // purposely not implemented
142  void operator=( const Self& ); // purposely not implemented
143 
144 }; // end class Timer
145 
146 
147 } // end namespace tmr
148 
149 
150 #endif // end #ifndef __elxTimer_H_
const std::string & PrintElapsedClock(void)
clock_t m_StopClock
Definition: elxTimer.h:117
double m_ElapsedClockSec
Definition: elxTimer.h:122
const std::string & PrintElapsedClockSec(void)
int StopTimer(void)
Timer Self
Definition: elxTimer.h:70
TimeDHMSType m_ElapsedTimeDHMS
Definition: elxTimer.h:120
virtual ~Timer()
Definition: elxTimer.h:111
itk::SmartPointer< Self > Pointer
Definition: elxTimer.h:72
const std::string & PrintStartTime(void)
double m_ElapsedTime
Definition: elxTimer.h:118
clock_t m_StartClock
Definition: elxTimer.h:115
std::string m_ElapsedClockSecString
Definition: elxTimer.h:137
const std::string & PrintElapsedTimeSec(void)
void StartTimer(void)
time_t m_StopTime
Definition: elxTimer.h:116
A class to time the different parts of the registration.
Definition: elxTimer.h:66
std::string m_ElapsedTimeDHMSString
Definition: elxTimer.h:134
int ElapsedClockAndTime(void)
std::string m_StartTimeString
Definition: elxTimer.h:132
clock_t m_ElapsedClock
Definition: elxTimer.h:119
const std::string & PrintStopTime(void)
itk::Object Superclass
Definition: elxTimer.h:71
const std::string & PrintElapsedTimeDHMS(void)
std::vector< std::vcl_size_t > TimeDHMSType
Definition: elxTimer.h:79
std::string m_ElapsedTimeSecString
Definition: elxTimer.h:135
time_t m_StartTime
Definition: elxTimer.h:111
std::vcl_size_t m_ElapsedTimeSec
Definition: elxTimer.h:121
void operator=(const Self &)
std::string m_StopTimeString
Definition: elxTimer.h:133
std::string m_ElapsedClockString
Definition: elxTimer.h:136
itk::SmartPointer< const Self > ConstPointer
Definition: elxTimer.h:73


Generated on 05-01-2014 for elastix by doxygen 1.8.5 elastix logo