nux-1.14.0
CPU.h
00001 /*
00002  * Copyright 2010 Inalogic® Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License, as
00006  * published by the  Free Software Foundation; either version 2.1 or 3.0
00007  * of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License along with this program. If not, see <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Jay Taoko <jaytaoko@inalogic.com>
00019  *
00020  */
00021 
00022 
00023 #ifndef NCPU_H
00024 #define NCPU_H
00025 
00026 namespace nux
00027 {
00028 
00029   class NCPU
00030   {
00031     NUX_DECLARE_GLOBAL_OBJECT (NCPU, GlobalSingletonInitializer);
00032   public:
00033 
00034     enum
00035     {
00036       CPU_UNKNOWN = 0,
00037       CPU_INTEL,
00038       CPU_AMD
00039     };
00040 
00041     enum
00042     {
00043       OS_UNKNOWN = 0,
00044       OS_WIN95,
00045       OS_WIN98,
00046       OS_WINME,
00047       OS_WINNT40,
00048       OS_WIN2000,
00049       OS_WINXP,
00050       OS_WINXP64,
00051       OS_WINSERVER2003,
00052       OS_WINSERVER2003R2,
00053       OS_WINVISTA,
00054       OS_WINVISTA64,
00055       OS_MACOS,
00056       OS_LINUX,
00057     };
00058 
00059     NString m_CPUString;  // GenuineIntel or AuthenticAMD
00060     NString m_CPUBrandString;
00061 
00062     struct CPUInfo
00063     {
00064       t_u32 m_CPUType;
00065       t_char m_CPUModel;
00066       t_char m_CPUExtModel;
00067       t_u32 m_CPUFamily;
00068       t_u32 m_CPUExtFamily;
00069       t_char m_CPUSteppingID;
00070       t_u32 m_CPUNumLogicalProcessors;
00071       t_u32 m_CPUSpeed;
00072     };
00073     struct CPUInfo m_CPUInfo;
00074 
00075     struct CPUFeatures
00076     {
00077       bool m_HasFPU;
00078       bool m_HasMMX;
00079       bool m_HasSSE;
00080       bool m_HasSSE2;
00081       bool m_HasSSE3;
00082       bool m_HasSSSE3;
00083       bool m_HasSSE41;
00084       bool m_HasSSE42;
00085       bool m_HasEST;          // Enhanced Intel SpeedStep Technology (Intel)
00086       bool m_HasHTT;          // Multithreading
00087       bool m_Has3DNow;        // 3Dnow! instructions (AMD)
00088       bool m_Has3DNowExt;     // 3DnowExt (AMD)
00089       bool m_HasAMDMMX;       // Extensions to MMX instructions (AMD)
00090       bool m_Hasx64;
00091 
00092     };
00093     struct CPUFeatures m_CPUFeatures;
00094 
00095     struct MemInfo
00096     {
00097       t_u32 m_PhysicalMemorySize;
00098     };
00099     struct MemInfo m_MemInfo;
00100 
00101     struct OSInfo
00102     {
00103       t_u32 m_OSType;
00104     };
00105 
00106     struct OSInfo m_OSInfo;
00107 
00108     bool IsBigEndian();
00109     bool IsLittleEndian();
00110   protected:
00111     bool m_IsLittleEndian;
00112     void GetOS();
00113 
00114   };
00115 
00116 }
00117 
00118 #endif // NCPU_H
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends