summaryrefslogtreecommitdiff
path: root/indra/llcommon/llsys.cpp
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2007-04-11 17:54:18 +0000
committerJosh Bell <josh@lindenlab.com>2007-04-11 17:54:18 +0000
commit0277259455c4354f81ea8a24c8ab93f27567bc6f (patch)
treef1411dab563dcf697f794e9e8a592a6d3e5c4d2d /indra/llcommon/llsys.cpp
parent568397bbcc4fca307ebc010ec7f815422b9ba80a (diff)
svn merge -r 59968:60342 svn+ssh://svn.lindenlab.com/svn/linden/branches/maintenance --> release
Diffstat (limited to 'indra/llcommon/llsys.cpp')
-rw-r--r--indra/llcommon/llsys.cpp43
1 files changed, 11 insertions, 32 deletions
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 54276f9f2f..6f0bda4b71 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -12,6 +12,7 @@
#include <iostream>
#include <zlib/zlib.h>
+
#include "processor.h"
#if LL_WINDOWS
@@ -289,50 +290,28 @@ LLCPUInfo::LLCPUInfo()
mFamily.assign( info->strFamily );
}
+
std::string LLCPUInfo::getCPUString() const
{
- std::string cpu_string;
-
#if LL_WINDOWS || LL_DARWIN
- // gather machine information.
- char proc_buf[CPUINFO_BUFFER_SIZE]; /* Flawfinder: ignore */
- CProcessor proc;
- if(proc.CPUInfoToText(proc_buf, CPUINFO_BUFFER_SIZE))
- {
- cpu_string.append(proc_buf);
- }
-#else
- cpu_string.append("Can't get CPU information");
-#endif
-
- return cpu_string;
-}
-
-std::string LLCPUInfo::getCPUStringTerse() const
-{
- std::string cpu_string;
+ std::ostringstream out;
-#if LL_WINDOWS || LL_DARWIN
CProcessor proc;
- const ProcessorInfo *info = proc.GetCPUInfo();
-
- cpu_string.append(info->strBrandID);
+ (void) proc.GetCPUInfo();
+ out << proc.strCPUName << " ";
- F64 freq = (F64)(S64)proc.GetCPUFrequency(50) / 1000000.f;
+ F32 freq = (F32)(proc.GetCPUFrequency(50) / 1000000.0);
// cpu speed is often way wrong, do a sanity check
- if (freq < 10000.f && freq > 200.f )
+ if (200.f < freq && freq < 10000.f)
{
- char tmp[MAX_STRING]; /* Flawfinder: ignore */
- snprintf(tmp, sizeof(tmp), " (%.0f Mhz)", freq); /* Flawfinder: ignore */
-
- cpu_string.append(tmp);
+ out << "(" << (S32)(freq) << " MHz)";
}
+
+ return out.str();
#else
- cpu_string.append("Can't get terse CPU information");
+ return "Can't get terse CPU information";
#endif
-
- return cpu_string;
}
void LLCPUInfo::stream(std::ostream& s) const