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


Generated on 27-04-2014 for elastix by doxygen 1.8.6 elastix logo