18 #ifndef itkMemoryUsageObserver_h
19 #define itkMemoryUsageObserver_h
21 #include "itkConfigure.h"
27 #if defined(WIN32) || defined(_WIN32)
29 # define SUPPORT_TOOLHELP32
30 # if defined(SUPPORT_TOOLHELP32)
31 using NTSTATUS = LONG;
60 #if defined(WIN32) || defined(_WIN32)
64 WindowsMemoryUsageObserver();
66 virtual ~WindowsMemoryUsageObserver();
69 virtual MemoryLoadType
73 # if defined(SUPPORT_TOOLHELP32)
74 using PZwQuerySystemInformation = NTSTATUS(WINAPI *)(UINT, PVOID, ULONG, PULONG);
77 HMODULE m_hNTLib{
nullptr };
79 PZwQuerySystemInformation ZwQuerySystemInformation{
nullptr };
80 # endif // defined(SUPPORT_TOOLHELP32)
82 #endif // defined(WIN32) || defined(_WIN32)
85 class ITKCommon_EXPORT LinuxMemoryUsageObserver :
public MemoryUsageObserverBase
89 ~LinuxMemoryUsageObserver()
override;
91 GetMemoryUsage()
override;
96 #if defined(__APPLE__)
97 class ITKCommon_EXPORT MacOSXMemoryUsageObserver :
public MemoryUsageObserverBase
101 ~MacOSXMemoryUsageObserver()
override;
103 GetMemoryUsage()
override;
108 #if defined(__SUNPRO_CC) || defined(__sun__)
109 class ITKCommon_EXPORT SunSolarisMemoryUsageObserver :
public MemoryUsageObserverBase
113 virtual ~SunSolarisMemoryUsageObserver();
114 virtual MemoryLoadType
117 #endif // Sun Solaris
120 #if !defined(WIN32) && !defined(_WIN32)
127 GetMemoryUsage()
override;
131 # if defined(ITK_HAS_MALLINFO) || defined(ITK_HAS_MALLINFO2)
140 ~MallinfoMemoryUsageObserver()
override;
142 GetMemoryUsage()
override;
145 #endif // !defined(WIN32) && !defined(_WIN32)
157 #if defined(WIN32) || defined(_WIN32)
158 public WindowsMemoryUsageObserver
159 #elif defined(__linux__)
160 public LinuxMemoryUsageObserver
161 #elif defined(__SUNPRO_CC) || defined(__sun__)
162 public SunSolarisMemoryUsageObserver
163 #elif defined(__APPLE__)
164 public MacOSXMemoryUsageObserver
165 #elif defined(__FreeBSD__) || defined(__OpenBSD__)
168 public MallinfoMemoryUsageObserver
177 #endif // itkMemoryUsageObserver_h