VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Filters/Core/vtkExecutionTimer.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkAppendFilter.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 
00034 #ifndef vtkExecutionTimer_h
00035 #define vtkExecutionTimer_h
00036 
00037 #include "vtkObject.h"
00038 #include "vtkFiltersCoreModule.h" // For export macro
00039 
00040 class vtkAlgorithm;
00041 class vtkCallbackCommand;
00042 
00043 class VTKFILTERSCORE_EXPORT vtkExecutionTimer : public vtkObject
00044 {
00045 public:
00046   vtkTypeMacro(vtkExecutionTimer, vtkObject);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00051   static vtkExecutionTimer* New();
00052 
00054 
00058   void SetFilter(vtkAlgorithm* filter);
00059   vtkGetObjectMacro(Filter, vtkAlgorithm);
00061 
00063 
00066   vtkGetMacro(ElapsedCPUTime, double);
00068 
00070 
00073   vtkGetMacro(ElapsedWallClockTime, double);
00075 
00076 protected:
00077   vtkExecutionTimer();
00078   ~vtkExecutionTimer();
00079 
00080   // This is the observer that will catch StartEvent and hand off to
00081   // EventRelay
00082   vtkCallbackCommand* Callback;
00083 
00084   // This is the filter that will be timed
00085   vtkAlgorithm* Filter;
00086 
00087   // These are where we keep track of the timestamps for start/end
00088   double CPUStartTime;
00089   double CPUEndTime;
00090 
00091   double WallClockStartTime;
00092   double WallClockEndTime;
00093 
00094   double ElapsedCPUTime;
00095   double ElapsedWallClockTime;
00096 
00098 
00101   void StartTimer();
00102   void StopTimer();
00104 
00107   virtual void TimerFinished();
00108 
00112   static void EventRelay(vtkObject* caller, unsigned long eventId, void* clientData, void* callData);
00113 
00114 private:
00115   vtkExecutionTimer(const vtkExecutionTimer&);  // Not implemented.
00116   void operator=(const vtkExecutionTimer&);     // Not implemented.
00117 
00118 };
00119 
00120 #endif