KWStyle - itkTimeProbe.cxx
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkTimeProbe.cxx.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 DEF =========================================================================*/
17
18 #include "itkTimeProbe.h"
19 #include "itkNumericTraits.h"
20
21 namespace itk
22 {
23
24 TimeProbe
25 ::TimeProbe()
26 {
27   m_TotalTime       = NumericTraits< TimeStampType >::ZeroValue();
28   m_Start           = NumericTraits< TimeStampType >::ZeroValue();
29   m_NumberOfStarts  = NumericTraits< CountType >::ZeroValue();
30   m_NumberOfStops   = NumericTraits< CountType >::ZeroValue();
31   m_RealTimeClock   = RealTimeClock::New();
32 }
33
34
35 TimeProbe
36 ::~TimeProbe()
37 {
38 }
39
40
41 EML
42 void 
43 TimeProbe
44 ::Start(void)
45 {
46   m_NumberOfStarts++;
47   m_Start = m_RealTimeClock->GetTimeStamp();
48 }
49  
50
51
52 void 
53 TimeProbe
54 ::Stop(void)
55 {
56   m_TotalTime += m_RealTimeClock->GetTimeStamp() - m_Start;
57   m_NumberOfStops++;
58 }
59
60
61     
62
63 TimeProbe::CountType
64 TimeProbe
65 ::GetNumberOfStarts(void) const
66 {
67   return m_NumberOfStarts;
68 }
69
70     
71
72 TimeProbe::CountType
73 TimeProbe
74 ::GetNumberOfStops(void) const
75 {
76   return m_NumberOfStops;
77 }
78
79
80 EML
81 TimeProbe::TimeStampType
82 TimeProbe
83 ::GetMeanTime(void) const
84 {
85   TimeStampType meanTime = 0.0f;
86
87   if( m_NumberOfStops )
88     {
89     meanTime = m_TotalTime / m_NumberOfStops;
90     }
91
92   return meanTime;
93
94 }
95
96
97 EML
98 // end namespace itk
99
100 EOF
101 EOF,EML

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:50PM
© Kitware Inc.