Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkMemoryUsageObserver.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMemoryUsageObserver.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-02-05 22:04:06 $
00007   Version:   $Revision: 1.3 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkMemoryUsageObserver_h
00019 #define __itkMemoryUsageObserver_h
00020 
00021 #include "itkConfigure.h"
00022 #include "itkMacro.h"
00023 #include "itkObject.h"
00024 #include "itkObjectFactory.h"
00025 
00026 #if defined(WIN32) || defined(_WIN32)
00027   #include <windows.h>
00028   #define SUPPORT_TOOLHELP32
00029   #if defined(SUPPORT_TOOLHELP32) 
00030 typedef LONG    NTSTATUS;
00031   #endif
00032 #endif
00033 
00034 namespace itk
00035 {
00036 
00045 class ITKCommon_EXPORT MemoryUsageObserverBase
00046 {
00047 public:
00049   typedef unsigned long        MemoryLoadType;
00050 
00052   virtual ~MemoryUsageObserverBase();
00053 
00055   virtual MemoryLoadType GetMemoryUsage() = 0;
00056 
00057 };
00058 
00059 #if defined(WIN32) || defined(_WIN32)
00060 class ITKCommon_EXPORT WindowsMemoryUsageObserver:public MemoryUsageObserverBase
00061 {
00062 public:
00063   WindowsMemoryUsageObserver();
00065   virtual ~WindowsMemoryUsageObserver();
00066 
00068   virtual MemoryLoadType GetMemoryUsage();
00069 protected:
00070 #if defined(SUPPORT_TOOLHELP32)
00071   typedef NTSTATUS (WINAPI * PZwQuerySystemInformation)(UINT, PVOID, ULONG, PULONG);
00073 
00074   // handle ntdll.dll library
00075   HMODULE                     m_hNTLib;
00076   // Windows native API function to query system information
00077   PZwQuerySystemInformation   ZwQuerySystemInformation;
00078 #endif // defined(SUPPORT_TOOLHELP32)
00079 };
00080 #endif // defined(WIN32) || defined(_WIN32)
00081 
00082 #ifdef linux
00083 class ITKCommon_EXPORT LinuxMemoryUsageObserver:public MemoryUsageObserverBase
00084 {
00085 public:
00087   virtual ~LinuxMemoryUsageObserver();
00088   virtual MemoryLoadType GetMemoryUsage();
00089 };
00090 #endif // linux
00091 
00092 
00093 #if defined(__APPLE__) && MAC_OS_X_VERSION >= MAC_OS_X_VERSION_10_2
00094 class ITKCommon_EXPORT MacOSXMemoryUsageObserver:public MemoryUsageObserverBase
00095 {
00096 public:
00098   virtual ~MacOSXMemoryUsageObserver();
00099   virtual MemoryLoadType GetMemoryUsage();
00100 };
00101 #endif // Mac OS X
00102 
00103 
00104 #if defined(__SUNPRO_CC) || defined (__sun__) 
00105 class ITKCommon_EXPORT SunSolarisMemoryUsageObserver:public MemoryUsageObserverBase
00106 {
00107 public:
00109   virtual ~SunSolarisMemoryUsageObserver();
00110   virtual MemoryLoadType GetMemoryUsage();
00111 };
00112 #endif // Sun Solaris
00113 
00114 
00115 #if !defined(WIN32) && !defined(_WIN32)
00116 class ITKCommon_EXPORT SysResourceMemoryUsageObserver:public MemoryUsageObserverBase
00117 {
00118 public:
00120   virtual ~SysResourceMemoryUsageObserver();
00121   virtual MemoryLoadType GetMemoryUsage();
00122 };
00123 #if !defined(__APPLE__) && !defined(__SUNPRO_CC) && !defined (__sun__) && !defined(__FreeBSD__)
00124 
00127 
00133 
00138 
00144 
00152 
00169 

Generated at Tue Sep 15 03:57:20 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000