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 const std::string& getOSStringSimple() const; 00055 00056 S32 mMajorVer; 00057 S32 mMinorVer; 00058 S32 mBuild; 00059 00060 #ifndef LL_WINDOWS 00061 static S32 getMaxOpenFiles(); 00062 #endif 00063 00064 static U32 getProcessVirtualSizeKB(); 00065 static U32 getProcessResidentSizeKB(); 00066 private: 00067 std::string mOSString; 00068 std::string mOSStringSimple; 00069 }; 00070 00071 00072 class LLCPUInfo 00073 { 00074 public: 00075 LLCPUInfo(); 00076 void stream(std::ostream& s) const; 00077 00078 std::string getCPUString() const; 00079 00080 bool hasAltivec() const; 00081 bool hasSSE() const; 00082 bool hasSSE2() const; 00083 S32 getMhz() const; 00084 00085 // Family is "AMD Duron" or "Intel Pentium Pro" 00086 const std::string& getFamily() const { return mFamily; } 00087 00088 private: 00089 bool mHasSSE; 00090 bool mHasSSE2; 00091 bool mHasAltivec; 00092 S32 mCPUMhz; 00093 std::string mFamily; 00094 std::string mCPUString; 00095 }; 00096 00097 //============================================================================= 00098 // 00099 // CLASS LLMemoryInfo 00100 00101 class LLMemoryInfo 00102 00111 { 00112 public: 00113 LLMemoryInfo(); 00114 void stream(std::ostream& s) const; 00115 00116 U32 getPhysicalMemoryKB() const; 00117 00121 U32 getPhysicalMemoryClamped() const; 00122 }; 00123 00124 00125 std::ostream& operator<<(std::ostream& s, const LLOSInfo& info); 00126 std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info); 00127 std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info); 00128 00129 // gunzip srcfile into dstfile. Returns FALSE on error. 00130 BOOL gunzip_file(const char *srcfile, const char *dstfile); 00131 // gzip srcfile into dstfile. Returns FALSE on error. 00132 BOOL gzip_file(const char *srcfile, const char *dstfile); 00133 00134 extern LLCPUInfo gSysCPU; 00135 00136 #endif // LL_LLSYS_H