00001 00032 #ifndef LL_SYS_H 00033 #define LL_SYS_H 00034 00035 // 00036 // The LLOSInfo, LLCPUInfo, and LLMemoryInfo classes are essentially 00037 // the same, but query different machine subsystems. Here's how you 00038 // use an LLCPUInfo object: 00039 // 00040 // LLCPUInfo info; 00041 // llinfos << info << llendl; 00042 // 00043 00044 #include <iosfwd> 00045 #include <string> 00046 00047 class LLOSInfo 00048 { 00049 public: 00050 LLOSInfo(); 00051 void stream(std::ostream& s) const; 00052 00053 const std::string& getOSString() const; 00054 00055 S32 mMajorVer; 00056 S32 mMinorVer; 00057 S32 mBuild; 00058 00059 #ifndef LL_WINDOWS 00060 static S32 getMaxOpenFiles(); 00061 #endif 00062 00063 static U32 getProcessVirtualSizeKB(); 00064 static U32 getProcessResidentSizeKB(); 00065 private: 00066 std::string mOSString; 00067 }; 00068 00069 00070 class LLCPUInfo 00071 { 00072 public: 00073 LLCPUInfo(); 00074 void stream(std::ostream& s) const; 00075 00076 std::string getCPUString() const; 00077 00078 bool hasAltivec() const; 00079 bool hasSSE() const; 00080 bool hasSSE2() const; 00081 S32 getMhz() const; 00082 00083 // Family is "AMD Duron" or "Intel Pentium Pro" 00084 const std::string& getFamily() const { return mFamily; } 00085 00086 private: 00087 bool mHasSSE; 00088 bool mHasSSE2; 00089 bool mHasAltivec; 00090 S32 mCPUMhz; 00091 std::string mFamily; 00092 std::string mCPUString; 00093 }; 00094 00095 //============================================================================= 00096 // 00097 // CLASS LLMemoryInfo 00098 00099 class LLMemoryInfo 00100 00109 { 00110 public: 00111 LLMemoryInfo(); 00112 void stream(std::ostream& s) const; 00113 00114 U32 getPhysicalMemoryKB() const; 00115 00119 U32 getPhysicalMemoryClamped() const; 00120 }; 00121 00122 00123 std::ostream& operator<<(std::ostream& s, const LLOSInfo& info); 00124 std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info); 00125 std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info); 00126 00127 // gunzip srcfile into dstfile. Returns FALSE on error. 00128 BOOL gunzip_file(const char *srcfile, const char *dstfile); 00129 // gzip srcfile into dstfile. Returns FALSE on error. 00130 BOOL gzip_file(const char *srcfile, const char *dstfile); 00131 00132 extern LLCPUInfo gSysCPU; 00133 00134 #endif // LL_LLSYS_H