ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkResourceProbe.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 itkResourceProbe_h
19#define itkResourceProbe_h
20
21#include "itkMacro.h"
22#include "itkIndent.h"
23#include "itkIntTypes.h"
24
25#include <iostream> // For cout.
26#include <string>
27#include <vector>
28
29#include "ITKCommonExport.h"
30
31namespace itk
32{
44template <typename ValueType, typename MeanType>
45class ITK_TEMPLATE_EXPORT ResourceProbe
46{
47public:
51
52public:
54 ResourceProbe(std::string type, std::string unit);
55
57 virtual ~ResourceProbe() = default;
58
59 ResourceProbe(const ResourceProbe &) = default;
62 operator=(const ResourceProbe &) = default;
64 operator=(ResourceProbe &&) = default;
65
67 [[nodiscard]] std::string
68 GetType() const;
69
71 [[nodiscard]] std::string
72 GetUnit() const;
73
75 virtual void
77
83 virtual void
85
87 [[nodiscard]] CountType
89
91 [[nodiscard]] CountType
93
95 [[nodiscard]] CountType
97
100 [[nodiscard]] virtual ValueType
101 GetInstantValue() const = 0;
102
105 [[nodiscard]] virtual ValueType
106 GetTotal() const;
107
111 [[nodiscard]] virtual MeanType
112 GetMean() const;
113
115 virtual void
117
120 [[nodiscard]] virtual ValueType
121 GetMinimum() const;
122
125 [[nodiscard]] virtual ValueType
126 GetMaximum() const;
127
130 virtual ValueType
132
135 virtual ValueType
137
139 virtual void
140 SetNameOfProbe(const char * nameOfProbe);
141
143 [[nodiscard]] virtual std::string
145
147 virtual void
148 PrintSystemInformation(std::ostream & os = std::cout);
149
151 virtual void
152 Report(std::ostream & os = std::cout, bool printSystemInfo = true, bool printReportHead = true, bool useTabs = false);
153
155 virtual void
156 ExpandedReport(std::ostream & os = std::cout,
157 bool printSystemInfo = true,
158 bool printReportHead = true,
159 bool useTabs = false);
160
162 virtual void
163 JSONReport(std::ostream & os = std::cout);
164
166 virtual void
167 PrintJSONSystemInformation(std::ostream & os = std::cout);
168
169protected:
171 virtual void
173
175 virtual void
176 PrintReportHead(std::ostream & os = std::cout, bool useTabs = false);
177
179 virtual void
180 PrintExpandedReportHead(std::ostream & os = std::cout, bool useTabs = false);
181
183 template <typename T>
184 void
185 PrintJSONvar(std::ostream & os, const char * varName, T varValue, unsigned int indent = 4, bool comma = true);
186
188 virtual void
189 Print(std::ostream & os, Indent indent) const;
190
191private:
192 ValueType m_StartValue{};
193 ValueType m_TotalValue{};
194 ValueType m_MinimumValue{};
195 ValueType m_MaximumValue{};
197 ValueType m_StandardError{};
198
202
203 std::vector<ValueType> m_ProbeValueList{};
204
205 std::string m_NameOfProbe{};
206 std::string m_TypeString{};
207 std::string m_UnitString{};
208
209 static constexpr unsigned int tabwidth = 15;
210};
211} // end namespace itk
212
213#ifndef ITK_MANUAL_INSTANTIATION
214# include "itkResourceProbe.hxx"
215#endif
216
217#endif // itkResourceProbe_h
Control indentation during Print() invocation.
Definition itkIndent.h:51
virtual void PrintReportHead(std::ostream &os=std::cout, bool useTabs=false)
std::string GetType() const
ResourceProbe & operator=(ResourceProbe &&)=default
virtual void SetNameOfProbe(const char *nameOfProbe)
virtual ~ResourceProbe()=default
virtual void PrintExpandedReportHead(std::ostream &os=std::cout, bool useTabs=false)
virtual ValueType GetStandardError()
virtual void Start()
virtual void UpdateMinimumMaximumMeasuredValue(ValueType value)
ResourceProbe(ResourceProbe &&)=default
CountType GetNumberOfIteration() const
virtual MeanType GetMean() const
std::string GetUnit() const
virtual void PrintJSONSystemInformation(std::ostream &os=std::cout)
virtual void JSONReport(std::ostream &os=std::cout)
ResourceProbe(std::string type, std::string unit)
ResourceProbe & operator=(const ResourceProbe &)=default
virtual ValueType GetTotal() const
virtual void Stop()
virtual std::string GetNameOfProbe() const
virtual void PrintSystemInformation(std::ostream &os=std::cout)
SizeValueType CountType
virtual ValueType GetMaximum() const
virtual void Print(std::ostream &os, Indent indent) const
ResourceProbe(const ResourceProbe &)=default
virtual void Reset()
virtual void ExpandedReport(std::ostream &os=std::cout, bool printSystemInfo=true, bool printReportHead=true, bool useTabs=false)
void PrintJSONvar(std::ostream &os, const char *varName, T varValue, unsigned int indent=4, bool comma=true)
virtual ValueType GetInstantValue() const =0
CountType GetNumberOfStops() const
virtual ValueType GetMinimum() const
CountType GetNumberOfStarts() const
virtual void Report(std::ostream &os=std::cout, bool printSystemInfo=true, bool printReportHead=true, bool useTabs=false)
virtual ValueType GetStandardDeviation()
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86