EXT-3780 Rewrote windows processor detection to support cpuid brandstring, and x64.
Refactored the CProcessor class into LLProcessorInfo. Reviewed by bradmeow-7.2.2
parent
7da0559c47
commit
dd500fb1fd
File diff suppressed because it is too large
Load Diff
|
|
@ -30,14 +30,30 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
// Author: Benjamin Jurke
|
||||
// File history: 27.02.2002 File created.
|
||||
///////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef LLPROCESSOR_H
|
||||
#define LLPROCESSOR_H
|
||||
|
||||
class LLProcessorInfo
|
||||
{
|
||||
public:
|
||||
LLProcessorInfo();
|
||||
~LLProcessorInfo();
|
||||
|
||||
F64 getCPUFrequency() const;
|
||||
bool hasSSE() const;
|
||||
bool hasSSE2() const;
|
||||
bool hasAltivec() const;
|
||||
std::string getCPUFamilyName() const;
|
||||
std::string getCPUBrandName() const;
|
||||
std::string getCPUFeatureDescription() const;
|
||||
};
|
||||
|
||||
# if 0
|
||||
// Author: Benjamin Jurke
|
||||
// File history: 27.02.2002 File created.
|
||||
///////////////////////////////////////////
|
||||
|
||||
// Options:
|
||||
///////////
|
||||
#if LL_WINDOWS
|
||||
|
|
@ -166,7 +182,7 @@ public:
|
|||
|
||||
// Private vars:
|
||||
////////////////
|
||||
public:
|
||||
private:
|
||||
F64 uqwFrequency;
|
||||
char strCPUName[128]; /* Flawfinder: ignore */
|
||||
ProcessorInfo CPUInfo;
|
||||
|
|
@ -192,5 +208,6 @@ public:
|
|||
bool WriteInfoTextFile(const std::string& strFilename);
|
||||
};
|
||||
|
||||
#endif // 0
|
||||
|
||||
#endif
|
||||
#endif // LLPROCESSOR_H
|
||||
|
|
|
|||
|
|
@ -513,18 +513,17 @@ U32 LLOSInfo::getProcessResidentSizeKB()
|
|||
LLCPUInfo::LLCPUInfo()
|
||||
{
|
||||
std::ostringstream out;
|
||||
CProcessor proc;
|
||||
const ProcessorInfo* info = proc.GetCPUInfo();
|
||||
LLProcessorInfo proc;
|
||||
// proc.WriteInfoTextFile("procInfo.txt");
|
||||
mHasSSE = info->_Ext.SSE_StreamingSIMD_Extensions;
|
||||
mHasSSE2 = info->_Ext.SSE2_StreamingSIMD2_Extensions;
|
||||
mHasAltivec = info->_Ext.Altivec_Extensions;
|
||||
mCPUMhz = (S32)(proc.GetCPUFrequency(50)/1000000.0);
|
||||
mFamily.assign( info->strFamily );
|
||||
mHasSSE = proc.hasSSE();
|
||||
mHasSSE2 = proc.hasSSE2();
|
||||
mHasAltivec = proc.hasAltivec();
|
||||
mCPUMhz = (S32)(proc.getCPUFrequency()/1000000.0);
|
||||
mFamily = proc.getCPUFamilyName();
|
||||
mCPUString = "Unknown";
|
||||
|
||||
#if LL_WINDOWS || LL_DARWIN || LL_SOLARIS
|
||||
out << proc.strCPUName;
|
||||
out << proc.getCPUBrandName();
|
||||
if (200 < mCPUMhz && mCPUMhz < 10000) // *NOTE: cpu speed is often way wrong, do a sanity check
|
||||
{
|
||||
out << " (" << mCPUMhz << " MHz)";
|
||||
|
|
@ -609,16 +608,7 @@ void LLCPUInfo::stream(std::ostream& s) const
|
|||
{
|
||||
#if LL_WINDOWS || LL_DARWIN || LL_SOLARIS
|
||||
// gather machine information.
|
||||
char proc_buf[CPUINFO_BUFFER_SIZE]; /* Flawfinder: ignore */
|
||||
CProcessor proc;
|
||||
if(proc.CPUInfoToText(proc_buf, CPUINFO_BUFFER_SIZE))
|
||||
{
|
||||
s << proc_buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
s << "Unable to collect processor information" << std::endl;
|
||||
}
|
||||
s << LLProcessorInfo().getCPUFeatureDescription();
|
||||
#else
|
||||
// *NOTE: This works on linux. What will it do on other systems?
|
||||
LLFILE* cpuinfo = LLFile::fopen(CPUINFO_FILE, "rb");
|
||||
|
|
|
|||
Loading…
Reference in New Issue