Skip to content
Snippets Groups Projects
Commit 8bef3ec2 authored by Brad King's avatar Brad King Committed by Code Review
Browse files

Merge "SystemInformation: get x86 CPU features from /proc/cpuinfo"

parents fe6698c9 03d6fbe5
No related branches found
No related tags found
No related merge requests found
......@@ -2940,6 +2940,55 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
this->Features.L1CacheSize += atoi(cacheSize.c_str());
}
}
// processor feature flags (probably x86 specific)
kwsys_stl::string cpuflags = this->ExtractValueFromCpuInfoFile(buffer,"flags");
if(!cpurev.empty())
{
// now we can match every flags as space + flag + space
cpuflags = " " + cpuflags + " ";
if ((cpuflags.find(" fpu ")!=kwsys_stl::string::npos))
{
this->Features.HasFPU = true;
}
if ((cpuflags.find(" tsc ")!=kwsys_stl::string::npos))
{
this->Features.HasTSC = true;
}
if ((cpuflags.find(" mmx ")!=kwsys_stl::string::npos))
{
this->Features.HasMMX = true;
}
if ((cpuflags.find(" sse ")!=kwsys_stl::string::npos))
{
this->Features.HasSSE = true;
}
if ((cpuflags.find(" sse2 ")!=kwsys_stl::string::npos))
{
this->Features.HasSSE2 = true;
}
if ((cpuflags.find(" apic ")!=kwsys_stl::string::npos))
{
this->Features.HasAPIC = true;
}
if ((cpuflags.find(" cmov ")!=kwsys_stl::string::npos))
{
this->Features.HasCMOV = true;
}
if ((cpuflags.find(" mtrr ")!=kwsys_stl::string::npos))
{
this->Features.HasMTRR = true;
}
if ((cpuflags.find(" acpi ")!=kwsys_stl::string::npos))
{
this->Features.HasACPI = true;
}
if ((cpuflags.find(" 3dnow ")!=kwsys_stl::string::npos))
{
this->Features.ExtendedFeatures.Has3DNow = true;
}
}
return true;
}
......
......@@ -86,6 +86,13 @@ int testSystemInformation(int, char*[])
printMethod3(info, GetHostMemoryUsed(), "KiB");
printMethod3(info, GetProcMemoryUsed(), "KiB");
for (int i = 0; i <= 31; i++)
{
if (info.DoesCPUSupportFeature(1 << i))
{
kwsys_ios::cout << "CPU feature " << i << "\n";
}
}
//int GetProcessorCacheXSize(long int);
// bool DoesCPUSupportFeature(long int);
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment