mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-15 14:22:57 -06:00
.SysInfo: Little optimization in GetCpuTemperatureHWMON()
git-svn-id: svn://ultimatepp.org/upp/trunk@6506 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
eb0bb40f31
commit
e652730262
1 changed files with 2 additions and 6 deletions
|
|
@ -483,20 +483,16 @@ static double GetCpuTemperatureACPI() {
|
|||
}
|
||||
|
||||
static double GetCpuTemperatureHWMON() {
|
||||
Vector <double> temps;
|
||||
double sumTemps = 0.;
|
||||
for (FindFile ff("/sys/class/hwmon/hwmon0/device/*input"); ff; ff.Next()) {
|
||||
if (!ff.IsHidden()) {
|
||||
String temp = LoadFile_Safe(ff.GetPath());
|
||||
if (!temp.IsEmpty())
|
||||
temps.Add((double)StrInt(temp) / 1000.0);
|
||||
sumTemps += double(StrInt(temp))/1000.;
|
||||
}
|
||||
}
|
||||
if (temps.IsEmpty())
|
||||
return Null;
|
||||
double sumTemps = 0.;
|
||||
for (int i = 0; i < temps.GetCount(); i++)
|
||||
sumTemps += temps[i];
|
||||
|
||||
return sumTemps/double(temps.GetCount());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue