VTK
vtkExecutionTimer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAppendFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
35 #ifndef vtkExecutionTimer_h
36 #define vtkExecutionTimer_h
37 
38 #include "vtkObject.h"
39 #include "vtkFiltersCoreModule.h" // For export macro
40 
41 class vtkAlgorithm;
42 class vtkCallbackCommand;
43 
44 class VTKFILTERSCORE_EXPORT vtkExecutionTimer : public vtkObject
45 {
46 public:
47  vtkTypeMacro(vtkExecutionTimer, vtkObject);
48  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
49 
54  static vtkExecutionTimer* New();
55 
57 
63  void SetFilter(vtkAlgorithm* filter);
64  vtkGetObjectMacro(Filter, vtkAlgorithm);
66 
68 
73  vtkGetMacro(ElapsedCPUTime, double);
75 
77 
82  vtkGetMacro(ElapsedWallClockTime, double);
84 
85 protected:
87  ~vtkExecutionTimer() VTK_OVERRIDE;
88 
89  // This is the observer that will catch StartEvent and hand off to
90  // EventRelay
91  vtkCallbackCommand* Callback;
92 
93  // This is the filter that will be timed
94  vtkAlgorithm* Filter;
95 
96  // These are where we keep track of the timestamps for start/end
97  double CPUStartTime;
98  double CPUEndTime;
99 
100  double WallClockStartTime;
101  double WallClockEndTime;
102 
103  double ElapsedCPUTime;
104  double ElapsedWallClockTime;
105 
107 
112  void StartTimer();
113  void StopTimer();
115 
120  virtual void TimerFinished();
121 
127  static void EventRelay(vtkObject* caller, unsigned long eventId, void* clientData, void* callData);
128 
129 private:
130  vtkExecutionTimer(const vtkExecutionTimer&) VTK_DELETE_FUNCTION;
131  void operator=(const vtkExecutionTimer&) VTK_DELETE_FUNCTION;
132 
133 };
134 
135 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
supports function callbacks
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:59
a simple class to control print indentation
Definition: vtkIndent.h:39
Time filter execution.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...