| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkTimeProbe.h.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 |
|
=========================================================================*/ |
| 17 |
DEF |
#ifndef __itkTimeProbe_H |
| 18 |
DEF |
#define __itkTimeProbe_H |
| 19 |
|
|
| 20 |
|
|
| 21 |
|
#include "itkRealTimeClock.h" |
| 22 |
|
#include "itkWin32Header.h" |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
namespace itk |
| 26 |
|
{ |
| 27 |
|
|
| 28 |
IND |
**/** \class TimeProbe |
| 29 |
IND |
**** |
| 30 |
IND |
**** \brief Class for computing the time passed between two points in the code. |
| 31 |
IND |
**** |
| 32 |
LEN,IND |
**** This class allows the user to trace the time passed between the execution of two pieces of code. |
| 33 |
LEN,IND |
**** It can be started and stopped in order to evaluate the execution over multiple passes. |
| 34 |
IND |
**** The values of time are taken from the RealTimeClock. |
| 35 |
IND |
**** |
| 36 |
IND |
**** \sa RealTimeClock |
| 37 |
IND |
**** |
| 38 |
IND |
****/ |
| 39 |
|
class ITKCommon_EXPORT TimeProbe |
| 40 |
|
{ |
| 41 |
|
|
| 42 |
|
public: |
| 43 |
|
|
| 44 |
LEN |
/** Type for counting how many times the probe has been started and stopped. */ |
| 45 |
|
typedef unsigned long CountType; |
| 46 |
|
|
| 47 |
|
/** Type for measuring time. See the RealTimeClock class for details on the |
| 48 |
|
* precision and units of this clock signal */ |
| 49 |
|
typedef RealTimeClock::TimeStampType TimeStampType; |
| 50 |
|
|
| 51 |
|
public: |
| 52 |
|
|
| 53 |
|
/** Constructor */ |
| 54 |
|
TimeProbe(); |
| 55 |
|
|
| 56 |
|
/** Destructor */ |
| 57 |
|
~TimeProbe(); |
| 58 |
|
|
| 59 |
|
/** Start counting the time */ |
| 60 |
|
void Start(void); |
| 61 |
|
|
| 62 |
|
/** Stop counting the time */ |
| 63 |
|
void Stop(void); |
| 64 |
|
|
| 65 |
|
/** Returns the number of times that the probe has been started. */ |
| 66 |
|
CountType GetNumberOfStarts(void) const; |
| 67 |
|
|
| 68 |
|
/** Returns the number of times that the probe has been stopped. */ |
| 69 |
|
CountType GetNumberOfStops(void) const; |
| 70 |
|
|
| 71 |
|
/** Returns the average times passed between the starts and stops of the |
| 72 |
|
* probe. See the RealTimeClock for details on the precision and units of |
| 73 |
|
* this time value. */ |
| 74 |
|
TimeStampType GetMeanTime(void) const; |
| 75 |
|
|
| 76 |
|
private: |
| 77 |
|
|
| 78 |
IND |
****TimeStampType m_Start; |
| 79 |
IND |
****TimeStampType m_TotalTime; |
| 80 |
|
|
| 81 |
IND |
****CountType m_NumberOfStarts; |
| 82 |
IND |
****CountType m_NumberOfStops; |
| 83 |
|
|
| 84 |
IND |
****RealTimeClock::Pointer m_RealTimeClock; |
| 85 |
|
}; |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
#endif |
| 91 |
|
|