Imported Upstream version 2.8.11.2
[platform/upstream/cmake.git] / Source / kwsys / SystemInformation.hxx.in
1 /*============================================================================
2   KWSys - Kitware System Library
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef @KWSYS_NAMESPACE@_SystemInformation_h
13 #define @KWSYS_NAMESPACE@_SystemInformation_h
14
15
16 /* Define these macros temporarily to keep the code readable.  */
17 #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
18 # define kwsys_stl @KWSYS_NAMESPACE@_stl
19 # define kwsys_ios @KWSYS_NAMESPACE@_ios
20 #endif
21 #include <@KWSYS_NAMESPACE@/stl/string>
22 #include <stddef.h> /* size_t */
23
24 namespace @KWSYS_NAMESPACE@
25 {
26
27 // forward declare the implementation class
28 class SystemInformationImplementation;
29
30 class @KWSYS_NAMESPACE@_EXPORT SystemInformation
31 {
32 #if @KWSYS_USE_LONG_LONG@
33   typedef long long LongLong;
34 #elif @KWSYS_USE___INT64@
35   typedef __int64 LongLong;
36 #else
37 # error "No Long Long"
38 #endif
39   friend class SystemInformationImplementation;
40   SystemInformationImplementation* Implementation;
41 public:
42
43   SystemInformation ();
44   ~SystemInformation ();
45
46   const char * GetVendorString();
47   const char * GetVendorID();
48   kwsys_stl::string GetTypeID();
49   kwsys_stl::string GetFamilyID();
50   kwsys_stl::string GetModelID();
51   kwsys_stl::string GetModelName();
52   kwsys_stl::string GetSteppingCode();
53   const char * GetExtendedProcessorName();
54   const char * GetProcessorSerialNumber();
55   int GetProcessorCacheSize();
56   unsigned int GetLogicalProcessorsPerPhysical();
57   float GetProcessorClockFrequency();
58   int GetProcessorAPICID();
59   int GetProcessorCacheXSize(long int);
60   bool DoesCPUSupportFeature(long int);
61
62   // returns an informative general description of the cpu
63   // on this system.
64   kwsys_stl::string GetCPUDescription();
65
66   const char * GetHostname();
67   kwsys_stl::string GetFullyQualifiedDomainName();
68
69   const char * GetOSName();
70   const char * GetOSRelease();
71   const char * GetOSVersion();
72   const char * GetOSPlatform();
73
74   int GetOSIsWindows();
75   int GetOSIsLinux();
76   int GetOSIsApple();
77
78   // returns an informative general description of the os
79   // on this system.
80   kwsys_stl::string GetOSDescription();
81
82   bool Is64Bits();
83
84   unsigned int GetNumberOfLogicalCPU(); // per physical cpu
85   unsigned int GetNumberOfPhysicalCPU();
86
87   bool DoesCPUSupportCPUID();
88
89   // Retrieve id of the current running process
90   LongLong GetProcessId();
91
92   // Retrieve memory information in megabyte.
93   size_t GetTotalVirtualMemory();
94   size_t GetAvailableVirtualMemory();
95   size_t GetTotalPhysicalMemory();
96   size_t GetAvailablePhysicalMemory();
97
98   // returns an informative general description if the installed and
99   // available ram on this system. See the  GetHostMmeoryTotal, and
100   // Get{Host,Proc}MemoryAvailable methods for more information.
101   kwsys_stl::string GetMemoryDescription(
102         const char *hostLimitEnvVarName=NULL,
103         const char *procLimitEnvVarName=NULL);
104
105   // Retrieve amount of physical memory installed on the system in KiB
106   // units.
107   LongLong GetHostMemoryTotal();
108
109   // Get total system RAM in units of KiB available colectivley to all
110   // processes in a process group. An example of a process group
111   // are the processes comprising an mpi program which is running in
112   // parallel. The amount of memory reported may differ from the host
113   // total if a host wide resource limit is applied. Such reource limits
114   // are reported to us via an applicaiton specified environment variable.
115   LongLong GetHostMemoryAvailable(const char *hostLimitEnvVarName=NULL);
116
117   // Get total system RAM in units of KiB available to this process.
118   // This may differ from the host available if a per-process resource
119   // limit is applied. per-process memory limits are applied on unix
120   // system via rlimit api. Resource limits that are not imposed via
121   // rlimit api may be reported to us via an application specified
122   // environment variable.
123   LongLong GetProcMemoryAvailable(
124         const char *hostLimitEnvVarName=NULL,
125         const char *procLimitEnvVarName=NULL);
126
127   // Get the system RAM used by all processes on the host, in units of KiB.
128   LongLong GetHostMemoryUsed();
129
130   // Get system RAM used by this process id in units of KiB.
131   LongLong GetProcMemoryUsed();
132
133   // enable/disable stack trace signal handler. In order to
134   // produce an informative stack trace the application should
135   // be dynamically linked and compiled with debug symbols.
136   static
137   void SetStackTraceOnError(int enable);
138
139   /** Run the different checks */
140   void RunCPUCheck();
141   void RunOSCheck();
142   void RunMemoryCheck();
143 };
144
145 } // namespace @KWSYS_NAMESPACE@
146
147 /* Undefine temporary macros.  */
148 #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
149 # undef kwsys_stl
150 # undef kwsys_ios
151 #endif
152
153 #endif