summaryrefslogtreecommitdiff
path: root/indra/llcommon/llprocessor.cpp
diff options
context:
space:
mode:
authorMark Palange (Mani) <palange@lindenlab.com>2010-05-11 16:27:50 -0700
committerMark Palange (Mani) <palange@lindenlab.com>2010-05-11 16:27:50 -0700
commit0db04cbb67d5420f98cc2090fdcca6bba948527b (patch)
tree0ad5db47bec2d447f055a608c39fb936088dc952 /indra/llcommon/llprocessor.cpp
parentab6d50440714b18d8d0811c9f2cc652c971e9b9d (diff)
EXT-3780 WIP Adding newline to linux getCPUFeatureDesc output
Diffstat (limited to 'indra/llcommon/llprocessor.cpp')
-rw-r--r--indra/llcommon/llprocessor.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index 463b07a7a5..a55765e329 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -240,7 +240,9 @@ public:
std::string getCPUFamilyName() const { return getInfo(eFamilyName, "Unknown").asString(); }
std::string getCPUBrandName() const { return getInfo(eBrandName, "Unknown").asString(); }
- std::string getCPUFeatureDescription() const
+ // This is virtual to support a different linux format.
+ // *NOTE:Mani - I didn't want to screw up server use of this data...
+ virtual std::string getCPUFeatureDescription() const
{
std::ostringstream out;
out << std::endl << std::endl;
@@ -671,6 +673,7 @@ private:
};
#elif LL_LINUX
+const char CPUINFO_FILE[] = "/proc/cpuinfo";
class LLProcessorInfoLinuxImpl : public LLProcessorInfoImpl
{
@@ -820,6 +823,33 @@ private:
# endif // LL_X86
}
+
+ std::string getCPUFeatureDescription() const
+ {
+ std::ostringstream s;
+
+ // *NOTE:Mani - This is for linux only.
+ 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;
+ s << std::endl;
+ }
+ fclose(cpuinfo);
+ s << std::endl;
+ }
+ else
+ {
+ s << "Unable to collect processor information" << std::endl;
+ }
+ return s.str();
+ }
+
};
@@ -839,11 +869,13 @@ LLProcessorInfo::LLProcessorInfo() : mImpl(NULL)
static LLProcessorInfoDarwinImpl the_impl;
mImpl = &the_impl;
#else
- #error "Unimplemented"
+ static LLProcessorInfoLinuxImpl the_impl;
+ mImpl = &the_impl;
#endif // LL_MSVC
}
}
+
LLProcessorInfo::~LLProcessorInfo() {}
F64 LLProcessorInfo::getCPUFrequency() const { return mImpl->getCPUFrequency(); }
bool LLProcessorInfo::hasSSE() const { return mImpl->hasSSE(); }