VTK  9.3.20240418
vtkExecutionTimer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
23 #ifndef vtkExecutionTimer_h
24 #define vtkExecutionTimer_h
25 
26 #include "vtkFiltersCoreModule.h" // For export macro
27 #include "vtkObject.h"
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkAlgorithm;
31 class vtkCallbackCommand;
32 
33 class VTKFILTERSCORE_EXPORT vtkExecutionTimer : public vtkObject
34 {
35 public:
36  vtkTypeMacro(vtkExecutionTimer, vtkObject);
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
44 
46 
52  void SetFilter(vtkAlgorithm* filter);
53  vtkGetObjectMacro(Filter, vtkAlgorithm);
55 
57 
62  vtkGetMacro(ElapsedCPUTime, double);
64 
66 
71  vtkGetMacro(ElapsedWallClockTime, double);
73 
74 protected:
76  ~vtkExecutionTimer() override;
77 
78  // This is the observer that will catch StartEvent and hand off to
79  // EventRelay
81 
82  // This is the filter that will be timed
84 
85  // These are where we keep track of the timestamps for start/end
86  double CPUStartTime;
87  double CPUEndTime;
88 
91 
94 
96 
101  void StartTimer();
102  void StopTimer();
104 
109  virtual void TimerFinished();
110 
116  static void EventRelay(
117  vtkObject* caller, unsigned long eventId, void* clientData, void* callData);
118 
119 private:
120  vtkExecutionTimer(const vtkExecutionTimer&) = delete;
121  void operator=(const vtkExecutionTimer&) = delete;
122 };
123 
124 VTK_ABI_NAMESPACE_END
125 #endif
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:162
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:108
abstract base class for most VTK objects
Definition: vtkObject.h:162