From e6527302622c2949100ee4fd279f4e7a08047579 Mon Sep 17 00:00:00 2001 From: koldo Date: Wed, 30 Oct 2013 20:41:30 +0000 Subject: [PATCH] .SysInfo: Little optimization in GetCpuTemperatureHWMON() git-svn-id: svn://ultimatepp.org/upp/trunk@6506 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/SysInfo/SysInfo.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bazaar/SysInfo/SysInfo.cpp b/bazaar/SysInfo/SysInfo.cpp index 6cdbd1e60..5764887fe 100644 --- a/bazaar/SysInfo/SysInfo.cpp +++ b/bazaar/SysInfo/SysInfo.cpp @@ -483,20 +483,16 @@ static double GetCpuTemperatureACPI() { } static double GetCpuTemperatureHWMON() { - Vector 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()); }