ITK  6.0.0
Insight Toolkit
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
60 std::string
61 GetType() const;
62
64 std::string
65 GetUnit() const;
66
68 virtual void
70
76 virtual void
78
82
86
90
93 virtual ValueType
94 GetInstantValue() const = 0;
95
98 virtual ValueType
99 GetTotal() const;
100
104 virtual MeanType
105 GetMean() const;
106
108 virtual void
110
113 virtual ValueType
114 GetMinimum() const;
115
118 virtual ValueType
119 GetMaximum() const;
120
123 virtual ValueType
125
128 virtual ValueType
130
132 virtual void
133 SetNameOfProbe(const char * nameOfProbe);
134
136 virtual std::string
138
140 virtual void
141 PrintSystemInformation(std::ostream & os = std::cout);
142
144 virtual void
145 Report(std::ostream & os = std::cout, bool printSystemInfo = true, bool printReportHead = true, bool useTabs = false);
146
148 virtual void
149 ExpandedReport(std::ostream & os = std::cout,
150 bool printSystemInfo = true,
151 bool printReportHead = true,
152 bool useTabs = false);
153
155 virtual void
156 JSONReport(std::ostream & os = std::cout);
157
159 virtual void
160 PrintJSONSystemInformation(std::ostream & os = std::cout);
161
162protected:
164 virtual void
166
168 virtual void
169 PrintReportHead(std::ostream & os = std::cout, bool useTabs = false);
170
172 virtual void
173 PrintExpandedReportHead(std::ostream & os = std::cout, bool useTabs = false);
174
176 template <typename T>
177 void
178 PrintJSONvar(std::ostream & os, const char * varName, T varValue, unsigned int indent = 4, bool comma = true);
179
181 virtual void
182 Print(std::ostream & os, Indent indent) const;
183
184private:
185 ValueType m_StartValue{};
186 ValueType m_TotalValue{};
187 ValueType m_MinimumValue{};
188 ValueType m_MaximumValue{};
189 ValueType m_StandardDeviation{};
190 ValueType m_StandardError{};
191
192 CountType m_NumberOfStarts{};
193 CountType m_NumberOfStops{};
194 CountType m_NumberOfIteration{};
195
196 std::vector<ValueType> m_ProbeValueList{};
197
198 std::string m_NameOfProbe{};
199 std::string m_TypeString{};
200 std::string m_UnitString{};
201
202 static constexpr unsigned int tabwidth = 15;
203};
204} // end namespace itk
205
206#ifndef ITK_MANUAL_INSTANTIATION
207# include "itkResourceProbe.hxx"
208#endif
209
210#endif // itkResourceProbe_h
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Computes the change of a value between two points in code.
virtual void PrintReportHead(std::ostream &os=std::cout, bool useTabs=false)
std::string GetType() const
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)
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)
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
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