Fixed: Number of processors under Linux

hg/feature/sound
kervala 14 years ago
parent 0cbb87bfe1
commit e254253fe0

@ -66,15 +66,20 @@ namespace NLMISC {
vector<string> splitted; vector<string> splitted;
explode(string(buffer), string("\n"), splitted, true); explode(string(buffer), string("\n"), splitted, true);
std::string value;
for(uint32 i = 0; i < splitted.size(); i++) for(uint32 i = 0; i < splitted.size(); i++)
{ {
vector<string> sline; vector<string> sline;
explode(splitted[i], string(":"), sline, true); explode(splitted[i], string(":"), sline, true);
if(sline.size() == 2 && trim(sline[0]) == colname) if(sline.size() == 2 && trim(sline[0]) == colname)
{ {
return trim(sline[1]); value = sline[1];
} }
} }
if (!value.empty())
return trim(value);
} }
nlwarning ("SI: Can't find the colname '%s' in /proc/cpuinfo", colname.c_str()); nlwarning ("SI: Can't find the colname '%s' in /proc/cpuinfo", colname.c_str());
return ""; return "";
@ -805,6 +810,9 @@ string CSystemInfo::getProc ()
#elif defined NL_OS_UNIX #elif defined NL_OS_UNIX
uint processors = 0;
if (fromString(getCpuInfo("processor"), processors)) ++processors;
ProcString = getCpuInfo("model name"); ProcString = getCpuInfo("model name");
ProcString += " / ?"; ProcString += " / ?";
ProcString += " Family " + getCpuInfo("cpu family"); ProcString += " Family " + getCpuInfo("cpu family");
@ -815,7 +823,7 @@ string CSystemInfo::getProc ()
ProcString += " / "; ProcString += " / ";
ProcString += getCpuInfo("cpu MHz")+"MHz"; ProcString += getCpuInfo("cpu MHz")+"MHz";
ProcString += " / "; ProcString += " / ";
ProcString += "? Processors found"; ProcString += toString("%u Processors found", processors);
#endif #endif

Loading…
Cancel
Save