VTK  9.2.20230327
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 "vtkFiltersCoreModule.h" // For export macro
39 #include "vtkObject.h"
40 
41 VTK_ABI_NAMESPACE_BEGIN
42 class vtkAlgorithm;
43 class vtkCallbackCommand;
44 
45 class VTKFILTERSCORE_EXPORT vtkExecutionTimer : public vtkObject
46 {
47 public:
48  vtkTypeMacro(vtkExecutionTimer, vtkObject);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
56 
58 
64  void SetFilter(vtkAlgorithm* filter);
65  vtkGetObjectMacro(Filter, vtkAlgorithm);
67 
69 
74  vtkGetMacro(ElapsedCPUTime, double);
76 
78 
83  vtkGetMacro(ElapsedWallClockTime, double);
85 
86 protected:
88  ~vtkExecutionTimer() override;
89 
90  // This is the observer that will catch StartEvent and hand off to
91  // EventRelay
93 
94  // This is the filter that will be timed
96 
97  // These are where we keep track of the timestamps for start/end
98  double CPUStartTime;
99  double CPUEndTime;
100 
103 
106 
108 
113  void StartTimer();
114  void StopTimer();
116 
121  virtual void TimerFinished();
122 
128  static void EventRelay(
129  vtkObject* caller, unsigned long eventId, void* clientData, void* callData);
130 
131 private:
132  vtkExecutionTimer(const vtkExecutionTimer&) = delete;
133  void operator=(const vtkExecutionTimer&) = delete;
134 };
135 
136 VTK_ABI_NAMESPACE_END
137 #endif
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:123
supports function callbacks
Time filter execution.
~vtkExecutionTimer() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static void EventRelay(vtkObject *caller, unsigned long eventId, void *clientData, void *callData)
This is the callback that VTK will invoke when it sees StartEvent and EndEvent.
void SetFilter(vtkAlgorithm *filter)
Set/get the filter to be monitored.
static vtkExecutionTimer * New()
Construct a new timer with no attached filter.
vtkCallbackCommand * Callback
virtual void TimerFinished()
This is where you can do anything you want with the progress event.
vtkAlgorithm * Filter
void StopTimer()
Convenience functions – StartTimer clears out the elapsed times and records start times; StopTimer re...
void StartTimer()
Convenience functions – StartTimer clears out the elapsed times and records start times; StopTimer re...
a simple class to control print indentation
Definition: vtkIndent.h:120
abstract base class for most VTK objects
Definition: vtkObject.h:83