RTK  2.6.0
Reconstruction Toolkit
rtkResourceProbesCollector.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 
19 #ifndef rtkResourceProbesCollector_h
20 #define rtkResourceProbesCollector_h
21 
22 #include "RTKExport.h"
23 #include "rtkConfiguration.h"
24 #include <itkTimeProbe.h>
25 #include <itkMemoryProbe.h>
26 
27 #ifdef RTK_USE_CUDA
28 # include <itkCudaMemoryProbe.h>
29 #endif
30 
31 namespace rtk
32 {
38 class RTK_EXPORT ResourceProbesCollector
39 {
40 public:
41  using IdType = std::string;
42  using TimeMapType = std::map<IdType, itk::TimeProbe>;
43  using MemoryMapType = std::map<IdType, itk::MemoryProbe>;
44 #ifdef RTK_USE_CUDA
45  using CudaMemoryMapType = std::map<IdType, itk::CudaMemoryProbe>;
46 #endif
47 
49  virtual ~ResourceProbesCollector() = default;
50 
53  virtual void
54  Start(const char * id);
55 
57  virtual void
58  Stop(const char * id);
59 
61  virtual void
62  Report(std::ostream & os = std::cout) const;
63 
66  virtual void
67  Clear();
68 
69 protected:
72 #ifdef RTK_USE_CUDA
73  CudaMemoryMapType m_CudaMemoryProbes;
74 #endif
75 };
76 } // namespace rtk
77 
78 #endif // rtkResourceProbesCollector_h
std::map< IdType, itk::MemoryProbe > MemoryMapType
std::map< IdType, itk::TimeProbe > TimeMapType
Aggregates a set of time, memory and cuda memory probes.