RTK  2.5.0
Reconstruction Toolkit
rtkGlobalResourceProbe.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright RTK Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef rtkGlobalResourceProbe_h
19 #define rtkGlobalResourceProbe_h
20 
21 #include <itkProcessObject.h>
24 #include "RTKExport.h"
25 #include <mutex>
26 
27 namespace rtk
28 {
36 class RTK_EXPORT GlobalResourceProbe : public itk::Object
37 {
38 public:
39  ITK_DISALLOW_COPY_AND_MOVE(GlobalResourceProbe);
40 
46 
48 #ifdef itkOverrideGetNameOfClassMacro
49  itkOverrideGetNameOfClassMacro(GlobalResourceProbe);
50 #else
51  itkTypeMacro(GlobalResourceProbe, itk::Object);
52 #endif
53 
54 
60  static Pointer
61  New();
62 
64  static Pointer
65  GetInstance();
66 
68  itkSetMacro(Verbose, bool);
69  itkGetMacro(Verbose, bool);
71 
74  virtual void
75  Start(const char * id);
76 
78  virtual void
79  Stop(const char * id);
80 
82  virtual void
83  Report(std::ostream & os = std::cout) const;
84 
87  virtual void
88  Clear();
89 
91  virtual void
92  Watch(itk::ProcessObject * o);
93 
95  virtual void
96  Remove(const rtk::WatcherForResourceProbe * w);
97 
98 protected:
100  ~GlobalResourceProbe() override;
101  void
102  PrintSelf(std::ostream & os, Indent indent) const override;
103  bool m_Verbose;
104 
106  std::vector<rtk::WatcherForResourceProbe *> m_Watchers;
107 
108 private:
110  std::mutex m_Mutex;
111 };
112 } // namespace rtk
113 
114 #endif
Very light watcher to monitor Start and End events on all filters.
ResourceProbesCollector m_ResourceProbesCollector
Aggregates a set of time, memory and cuda memory probes.
#define itkSetMacro(name, type)
std::vector< rtk::WatcherForResourceProbe * > m_Watchers