mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
solid: do not attempt to obtain maximum CPU speed from /proc/cpuinfo
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
3cd1afd6ab
commit
9f4ed8c837
1 changed files with 2 additions and 6 deletions
|
@ -19,7 +19,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "udevprocessor.h"
|
#include "udevprocessor.h"
|
||||||
|
|
||||||
#include "udevdevice.h"
|
#include "udevdevice.h"
|
||||||
#include "cpuinfo.h"
|
#include "cpuinfo.h"
|
||||||
|
|
||||||
|
@ -48,6 +47,7 @@ int Processor::number() const
|
||||||
return m_device->deviceNumber();
|
return m_device->deviceNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: do not parse /proc/cpuinfo for "cpu MHz", that may be current not maximum speed
|
||||||
int Processor::maxSpeed() const
|
int Processor::maxSpeed() const
|
||||||
{
|
{
|
||||||
if (m_maxSpeed == -1) {
|
if (m_maxSpeed == -1) {
|
||||||
|
@ -57,10 +57,6 @@ int Processor::maxSpeed() const
|
||||||
// cpuinfo_max_freq is in kHz
|
// cpuinfo_max_freq is in kHz
|
||||||
m_maxSpeed = static_cast<int>(value.toLongLong() / 1000);
|
m_maxSpeed = static_cast<int>(value.toLongLong() / 1000);
|
||||||
}
|
}
|
||||||
if (m_maxSpeed <= 0) {
|
|
||||||
// couldn't get the info from /sys, try /proc instead
|
|
||||||
m_maxSpeed = extractCpuInfoLine(number(), "cpu MHz\\s+:\\s+(\\d+).*").toInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return m_maxSpeed;
|
return m_maxSpeed;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +118,7 @@ Solid::Processor::InstructionSets Processor::instructionSets() const
|
||||||
|
|
||||||
QString Processor::prefix() const
|
QString Processor::prefix() const
|
||||||
{
|
{
|
||||||
QLatin1String sysPrefix("/sysdev");
|
const QLatin1String sysPrefix("/sysdev");
|
||||||
if (QFile::exists(m_device->deviceName() + sysPrefix)) {
|
if (QFile::exists(m_device->deviceName() + sysPrefix)) {
|
||||||
return sysPrefix;
|
return sysPrefix;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue