7#include "udevprocessor.h"
9#include "../shared/cpufeatures.h"
11#include "udevdevice.h"
15using namespace Solid::Backends::UDev;
17Processor::Processor(UDevDevice *device)
18 : DeviceInterface(device)
19 , m_canChangeFrequency(NotChecked)
24Processor::~Processor()
28int Processor::number()
const
34 return m_device->deviceNumber();
37int Processor::maxSpeed()
const
39 if (m_maxSpeed == -1) {
40 QFile cpuMaxFreqFile(m_device->deviceName() + prefix() +
"/cpufreq/cpuinfo_max_freq");
44 m_maxSpeed =
static_cast<int>(value.
toLongLong() / 1000);
46 if (m_maxSpeed <= 0) {
48 m_maxSpeed = extractCurrentCpuSpeed(number());
54bool Processor::canChangeFrequency()
const
56 if (m_canChangeFrequency == NotChecked) {
60 m_canChangeFrequency = CannotChangeFreq;
62 QFile cpuMinFreqFile(m_device->deviceName() + prefix() +
"/cpufreq/cpuinfo_min_freq");
63 QFile cpuMaxFreqFile(m_device->deviceName() + prefix() +
"/cpufreq/cpuinfo_max_freq");
65 qlonglong minFreq = cpuMinFreqFile.readAll().trimmed().toLongLong();
66 qlonglong maxFreq = cpuMaxFreqFile.readAll().trimmed().toLongLong();
67 if (minFreq > 0 && maxFreq > minFreq) {
68 m_canChangeFrequency = CanChangeFreq;
73 return m_canChangeFrequency == CanChangeFreq;
83QString Processor::prefix()
const
93#include "moc_udevprocessor.cpp"
bool exists() const const
qlonglong toLongLong(bool *ok, int base) const const
QString trimmed() const const