Automated merge with ssh://hg.lindenlab.com/dessie/viewer-public

meow-7.2.2
palange 2010-05-27 14:10:19 -07:00
commit 5fb6f4fe93
6 changed files with 761 additions and 2393 deletions

View File

@ -232,7 +232,6 @@ set(llcommon_HEADER_FILES
metaclasst.h
metaproperty.h
metapropertyt.h
processor.h
reflective.h
reflectivet.h
roles_constants.h

View File

@ -238,7 +238,7 @@ U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer
#else // windows or x86-mac or x86-linux or x86-solaris
U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer
{
static U64 sCPUClockFrequency = U64(CProcessor().GetCPUFrequency(50));
static U64 sCPUClockFrequency = U64(LLProcessorInfo().getCPUFrequency());
// we drop the low-order byte in our timers, so report a lower frequency
return sCPUClockFrequency >> 8;

File diff suppressed because it is too large Load Diff

View File

@ -30,167 +30,26 @@
* $/LicenseInfo$
*/
// Author: Benjamin Jurke
// File history: 27.02.2002 File created.
///////////////////////////////////////////
#ifndef LLPROCESSOR_H
#define LLPROCESSOR_H
class LLProcessorInfoImpl;
// Options:
///////////
#if LL_WINDOWS
#define PROCESSOR_FREQUENCY_MEASURE_AVAILABLE
#endif
#if LL_MSVC && _M_X64
# define LL_X86_64 1
# define LL_X86 1
#elif LL_MSVC && _M_IX86
# define LL_X86 1
#elif LL_GNUC && ( defined(__amd64__) || defined(__x86_64__) )
# define LL_X86_64 1
# define LL_X86 1
#elif LL_GNUC && ( defined(__i386__) )
# define LL_X86 1
#elif LL_GNUC && ( defined(__powerpc__) || defined(__ppc__) )
# define LL_PPC 1
#endif
struct ProcessorExtensions
class LLProcessorInfo
{
bool FPU_FloatingPointUnit;
bool VME_Virtual8086ModeEnhancements;
bool DE_DebuggingExtensions;
bool PSE_PageSizeExtensions;
bool TSC_TimeStampCounter;
bool MSR_ModelSpecificRegisters;
bool PAE_PhysicalAddressExtension;
bool MCE_MachineCheckException;
bool CX8_COMPXCHG8B_Instruction;
bool APIC_AdvancedProgrammableInterruptController;
unsigned int APIC_ID;
bool SEP_FastSystemCall;
bool MTRR_MemoryTypeRangeRegisters;
bool PGE_PTE_GlobalFlag;
bool MCA_MachineCheckArchitecture;
bool CMOV_ConditionalMoveAndCompareInstructions;
bool FGPAT_PageAttributeTable;
bool PSE36_36bitPageSizeExtension;
bool PN_ProcessorSerialNumber;
bool CLFSH_CFLUSH_Instruction;
unsigned int CLFLUSH_InstructionCacheLineSize;
bool DS_DebugStore;
bool ACPI_ThermalMonitorAndClockControl;
bool EMMX_MultimediaExtensions;
bool MMX_MultimediaExtensions;
bool FXSR_FastStreamingSIMD_ExtensionsSaveRestore;
bool SSE_StreamingSIMD_Extensions;
bool SSE2_StreamingSIMD2_Extensions;
bool Altivec_Extensions;
bool SS_SelfSnoop;
bool HT_HyperThreading;
unsigned int HT_HyterThreadingSiblings;
bool TM_ThermalMonitor;
bool IA64_Intel64BitArchitecture;
bool _3DNOW_InstructionExtensions;
bool _E3DNOW_InstructionExtensions;
bool AA64_AMD64BitArchitecture;
};
struct ProcessorCache
{
bool bPresent;
char strSize[32]; /* Flawfinder: ignore */
unsigned int uiAssociativeWays;
unsigned int uiLineSize;
bool bSectored;
char strCache[128]; /* Flawfinder: ignore */
};
struct ProcessorL1Cache
{
ProcessorCache Instruction;
ProcessorCache Data;
};
struct ProcessorTLB
{
bool bPresent;
char strPageSize[32]; /* Flawfinder: ignore */
unsigned int uiAssociativeWays;
unsigned int uiEntries;
char strTLB[128]; /* Flawfinder: ignore */
};
struct ProcessorInfo
{
char strVendor[16]; /* Flawfinder: ignore */
unsigned int uiFamily;
unsigned int uiExtendedFamily;
char strFamily[64]; /* Flawfinder: ignore */
unsigned int uiModel;
unsigned int uiExtendedModel;
char strModel[128]; /* Flawfinder: ignore */
unsigned int uiStepping;
unsigned int uiType;
char strType[64]; /* Flawfinder: ignore */
unsigned int uiBrandID;
char strBrandID[64]; /* Flawfinder: ignore */
char strProcessorSerial[64]; /* Flawfinder: ignore */
unsigned long MaxSupportedLevel;
unsigned long MaxSupportedExtendedLevel;
ProcessorExtensions _Ext;
ProcessorL1Cache _L1;
ProcessorCache _L2;
ProcessorCache _L3;
ProcessorCache _Trace;
ProcessorTLB _Instruction;
ProcessorTLB _Data;
};
// CProcessor
// ==========
// Class for detecting the processor name, type and available
// extensions as long as it's speed.
/////////////////////////////////////////////////////////////
class CProcessor
{
// Constructor / Destructor:
////////////////////////////
public:
CProcessor();
LLProcessorInfo();
~LLProcessorInfo();
// Private vars:
////////////////
public:
F64 uqwFrequency;
char strCPUName[128]; /* Flawfinder: ignore */
ProcessorInfo CPUInfo;
// Private functions:
/////////////////////
F64 getCPUFrequency() const;
bool hasSSE() const;
bool hasSSE2() const;
bool hasAltivec() const;
std::string getCPUFamilyName() const;
std::string getCPUBrandName() const;
std::string getCPUFeatureDescription() const;
private:
bool AnalyzeIntelProcessor();
bool AnalyzeAMDProcessor();
bool AnalyzeUnknownProcessor();
bool CheckCPUIDPresence();
void DecodeProcessorConfiguration(unsigned int cfg);
void TranslateProcessorConfiguration();
void GetStandardProcessorConfiguration();
void GetStandardProcessorExtensions();
// Public functions:
////////////////////
public:
F64 GetCPUFrequency(unsigned int uiMeasureMSecs);
const ProcessorInfo *GetCPUInfo();
bool CPUInfoToText(char *strBuffer, unsigned int uiMaxLen);
bool WriteInfoTextFile(const std::string& strFilename);
LLProcessorInfoImpl* mImpl;
};
#endif
#endif // LLPROCESSOR_H

View File

@ -58,7 +58,6 @@
# include <unistd.h>
# include <sys/sysinfo.h>
const char MEMINFO_FILE[] = "/proc/meminfo";
const char CPUINFO_FILE[] = "/proc/cpuinfo";
#elif LL_SOLARIS
# include <stdio.h>
# include <unistd.h>
@ -513,71 +512,21 @@ 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 = (F64)(proc.GetCPUFrequency(50)/1000000.0F);
mFamily.assign( info->strFamily );
mHasSSE = proc.hasSSE();
mHasSSE2 = proc.hasSSE2();
mHasAltivec = proc.hasAltivec();
mCPUMHz = (F64)(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)";
}
mCPUString = out.str();
#elif LL_LINUX
std::map< std::string, std::string > cpuinfo;
LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb");
if(cpuinfo_fp)
{
char line[MAX_STRING];
memset(line, 0, MAX_STRING);
while(fgets(line, MAX_STRING, cpuinfo_fp))
{
// /proc/cpuinfo on Linux looks like:
// name\t*: value\n
char* tabspot = strchr( line, '\t' );
if (tabspot == NULL)
continue;
char* colspot = strchr( tabspot, ':' );
if (colspot == NULL)
continue;
char* spacespot = strchr( colspot, ' ' );
if (spacespot == NULL)
continue;
char* nlspot = strchr( line, '\n' );
if (nlspot == NULL)
nlspot = line + strlen( line ); // Fallback to terminating NUL
std::string linename( line, tabspot );
std::string llinename(linename);
LLStringUtil::toLower(llinename);
std::string lineval( spacespot + 1, nlspot );
cpuinfo[ llinename ] = lineval;
}
fclose(cpuinfo_fp);
}
# if LL_X86
std::string flags = " " + cpuinfo["flags"] + " ";
LLStringUtil::toLower(flags);
mHasSSE = ( flags.find( " sse " ) != std::string::npos );
mHasSSE2 = ( flags.find( " sse2 " ) != std::string::npos );
F64 mhz;
if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz)
&& 200.0 < mhz && mhz < 10000.0)
{
mCPUMHz = (F64)(mhz);
}
if (!cpuinfo["model name"].empty())
mCPUString = cpuinfo["model name"];
# endif // LL_X86
#endif // LL_LINUX
}
bool LLCPUInfo::hasAltivec() const
@ -607,38 +556,9 @@ std::string LLCPUInfo::getCPUString() const
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;
}
#else
// *NOTE: This works on linux. What will it do on other systems?
LLFILE* cpuinfo = LLFile::fopen(CPUINFO_FILE, "rb");
if(cpuinfo)
{
char line[MAX_STRING];
memset(line, 0, MAX_STRING);
while(fgets(line, MAX_STRING, cpuinfo))
{
line[strlen(line)-1] = ' ';
s << line;
}
fclose(cpuinfo);
s << std::endl;
}
else
{
s << "Unable to collect processor information" << std::endl;
}
#endif
s << LLProcessorInfo().getCPUFeatureDescription();
// These are interesting as they reflect our internal view of the
// CPU's attributes regardless of platform
s << "->mHasSSE: " << (U32)mHasSSE << std::endl;

View File

@ -330,10 +330,6 @@ const char *VFS_INDEX_FILE_BASE = "index.db2.x.";
static std::string gWindowTitle;
std::string gLoginPage;
std::vector<std::string> gLoginURIs;
static std::string gHelperURI;
LLAppViewer::LLUpdaterInfo *LLAppViewer::sUpdaterInfo = NULL ;
void idle_afk_check()