ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkResourceProbe.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software 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  * http://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 "itkIntTypes.h"
23 
24 #include <string>
25 #include <vector>
26 
27 #include "ITKCommonExport.h"
28 
29 namespace itk
30 {
42 template< typename ValueType, typename MeanType >
43 class ITK_TEMPLATE_EXPORT ResourceProbe
44 {
45 public:
46 
50 
51 public:
52 
54  ResourceProbe(const std::string & type, const std::string & unit);
55 
57  virtual ~ResourceProbe();
58 
60  std::string GetType() const;
61 
63  std::string GetUnit() const;
64 
66  virtual void Start();
67 
73  virtual void Stop();
74 
76  CountType GetNumberOfStarts() const;
77 
79  CountType GetNumberOfStops() const;
80 
82  CountType GetNumberOfIteration() const;
83 
86  virtual ValueType GetInstantValue(void) const = 0;
87 
90  virtual ValueType GetTotal() const;
91 
95  virtual MeanType GetMean() const;
96 
98  virtual void Reset();
99 
102  virtual ValueType GetMinimum() const;
103 
106  virtual ValueType GetMaximum() const;
107 
110  virtual ValueType GetStandardDeviation();
111 
114  virtual ValueType GetStandardError();
115 
117  virtual void SetNameOfProbe(const char* nameOfProbe);
118 
120  virtual std::string GetNameOfProbe() const;
121 
123  virtual void PrintSystemInformation(std::ostream & os = std::cout);
124 
126  virtual void Report(std::ostream & os = std::cout, bool printSystemInfo = true,
127  bool printReportHead = true, bool useTabs = false);
128 
130  virtual void ExpandedReport(std::ostream & os = std::cout, bool printSystemInfo = true,
131  bool printReportHead = true, bool useTabs = false);
132 
134  virtual void JSONReport(std::ostream & os = std::cout);
135 
137  virtual void PrintJSONSystemInformation(std::ostream & os = std::cout);
138 
139 protected:
141  virtual void UpdateMinimumMaximumMeasuredValue(ValueType value);
142 
144  virtual void PrintReportHead(std::ostream & os = std::cout, bool useTabs = false);
145 
147  virtual void PrintExpandedReportHead(std::ostream & os = std::cout, bool useTabs = false);
148 
150  template<typename T>
151  void PrintJSONvar(std::ostream & os, const char* varName, T varValue,
152  unsigned indent = 4, bool comma = true);
153 
155  virtual void GetSystemInformation();
156 
157 private:
158 
159  ValueType m_StartValue;
160  ValueType m_TotalValue;
161  ValueType m_MinimumValue;
162  ValueType m_MaximumValue;
163  MeanType m_MeanValue;
165  ValueType m_StandardError;
166 
170 
171  std::vector<ValueType> m_ProbeValueList;
172 
173  std::string m_NameOfProbe;
174  std::string m_TypeString;
175  std::string m_UnitString;
176 
177  std::string m_SystemName;
178  std::string m_ProcessorName;
181  unsigned int m_NumberOfPhysicalCPU;
182  unsigned int m_NumberOfLogicalCPU;
183  std::string m_OSName;
184  std::string m_OSRelease;
185  std::string m_OSVersion;
186  std::string m_OSPlatform;
188  std::string m_ITKVersion;
193 
194  static ITK_CONSTEXPR_VAR unsigned int tabwidth = 15;
195 };
196 } // end namespace itk
197 
198 #ifndef ITK_MANUAL_INSTANTIATION
199 #include "itkResourceProbe.hxx"
200 #endif
201 
202 #endif //itkResourceProbe_h
std::string m_ProcessorName
vcl_size_t m_AvailablePhysicalMemory
ValueType m_StandardDeviation
*brief Mask an image with the negative of a mask **This class is templated over the types of the *input image type
std::string m_ITKVersion
std::string m_TypeString
vcl_size_t m_AvailableVirtualMemory
unsigned long SizeValueType
Definition: itkIntTypes.h:143
vcl_size_t m_TotalVirtualMemory
std::string m_UnitString
unsigned int m_NumberOfLogicalCPU
vcl_size_t m_TotalPhysicalMemory
std::string m_NameOfProbe
std::string m_OSPlatform
unsigned int m_NumberOfPhysicalCPU
CountType m_NumberOfIteration
SizeValueType CountType
std::vector< ValueType > m_ProbeValueList
Computes the change of a value between two points in code.
std::string m_SystemName