RTK  2.6.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  itkOverrideGetNameOfClassMacro(GlobalResourceProbe);
49 
55  static Pointer
56  New();
57 
59  static Pointer
60  GetInstance();
61 
63  itkSetMacro(Verbose, bool);
64  itkGetMacro(Verbose, bool);
66 
69  virtual void
70  Start(const char * id);
71 
73  virtual void
74  Stop(const char * id);
75 
77  virtual void
78  Report(std::ostream & os = std::cout) const;
79 
82  virtual void
83  Clear();
84 
86  virtual void
87  Watch(itk::ProcessObject * o);
88 
90  virtual void
91  Remove(const rtk::WatcherForResourceProbe * w);
92 
93 protected:
95  ~GlobalResourceProbe() override;
96  void
97  PrintSelf(std::ostream & os, Indent indent) const override;
98  bool m_Verbose;
99 
101  std::vector<rtk::WatcherForResourceProbe *> m_Watchers;
102 
103 private:
105  std::mutex m_Mutex;
106 };
107 } // namespace rtk
108 
109 #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