diff options
author | Oz Linden <oz@lindenlab.com> | 2018-01-19 11:18:29 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2018-01-19 11:18:29 -0500 |
commit | a7911c43791a76f0f93f920f527970125afdc730 (patch) | |
tree | 99228045170856cf7721e83274bc9d74b45f42a4 /indra/llcommon/llprocessor.cpp | |
parent | 444643aeb0b80fdfbe28e0e2faae56de9d4f6e4a (diff) | |
parent | 7acbd8ed8d73c507675d45360df07d232c431a8b (diff) |
merge changes for 5.1.0-release
Diffstat (limited to 'indra/llcommon/llprocessor.cpp')
-rw-r--r-- | indra/llcommon/llprocessor.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index e3e1d0c391..446c312ca9 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -26,9 +26,11 @@ #include "linden_common.h" #include "llprocessor.h" - +#include "llstring.h" +#include "stringize.h" #include "llerror.h" +#include <iomanip> //#include <memory> #if LL_WINDOWS @@ -188,7 +190,7 @@ namespace case 0xF: return "Intel Pentium 4"; case 0x10: return "Intel Itanium 2 (IA-64)"; } - return "Unknown"; + return STRINGIZE("Intel <unknown 0x" << std::hex << composed_family << ">"); } std::string amd_CPUFamilyName(int composed_family) @@ -201,26 +203,26 @@ namespace case 0xF: return "AMD K8"; case 0x10: return "AMD K8L"; } - return "Unknown"; + return STRINGIZE("AMD <unknown 0x" << std::hex << composed_family << ">"); } std::string compute_CPUFamilyName(const char* cpu_vendor, int family, int ext_family) { const char* intel_string = "GenuineIntel"; const char* amd_string = "AuthenticAMD"; - if(!strncmp(cpu_vendor, intel_string, strlen(intel_string))) + if (LLStringUtil::startsWith(cpu_vendor, intel_string)) { U32 composed_family = family + ext_family; return intel_CPUFamilyName(composed_family); } - else if(!strncmp(cpu_vendor, amd_string, strlen(amd_string))) + else if (LLStringUtil::startsWith(cpu_vendor, amd_string)) { U32 composed_family = (family == 0xF) ? family + ext_family : family; return amd_CPUFamilyName(composed_family); } - return "Unknown"; + return STRINGIZE("Unrecognized CPU vendor <" << cpu_vendor << ">"); } } // end unnamed namespace @@ -258,8 +260,8 @@ public: return hasExtension("Altivec"); } - std::string getCPUFamilyName() const { return getInfo(eFamilyName, "Unknown").asString(); } - std::string getCPUBrandName() const { return getInfo(eBrandName, "Unknown").asString(); } + std::string getCPUFamilyName() const { return getInfo(eFamilyName, "Unset family").asString(); } + std::string getCPUBrandName() const { return getInfo(eBrandName, "Unset brand").asString(); } // This is virtual to support a different linux format. // *NOTE:Mani - I didn't want to screw up server use of this data... @@ -271,7 +273,7 @@ public: out << "//////////////////////////" << std::endl; out << "Processor Name: " << getCPUBrandName() << std::endl; out << "Frequency: " << getCPUFrequency() << " MHz" << std::endl; - out << "Vendor: " << getInfo(eVendor, "Unknown").asString() << std::endl; + out << "Vendor: " << getInfo(eVendor, "Unset vendor").asString() << std::endl; out << "Family: " << getCPUFamilyName() << " (" << getInfo(eFamily, 0) << ")" << std::endl; out << "Extended family: " << getInfo(eExtendedFamily, 0) << std::endl; out << "Model: " << getInfo(eModel, 0) << std::endl; @@ -398,7 +400,7 @@ static F64 calculate_cpu_frequency(U32 measure_msecs) HANDLE hThread = GetCurrentThread(); unsigned long dwCurPriorityClass = GetPriorityClass(hProcess); int iCurThreadPriority = GetThreadPriority(hThread); - unsigned long dwProcessMask, dwSystemMask, dwNewMask = 1; + DWORD_PTR dwProcessMask, dwSystemMask, dwNewMask = 1; GetProcessAffinityMask(hProcess, &dwProcessMask, &dwSystemMask); SetPriorityClass(hProcess, REALTIME_PRIORITY_CLASS); |