diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-11 11:26:39 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-11 11:26:39 -0500 |
commit | 7abcdb6683ea49819e25f88536f38076264869a6 (patch) | |
tree | c2d92791cd5a84e892446ed320298f67d0d53b3b /tdecore/tdehardwaredevices.cpp | |
parent | 8e467d8b605da6ada6e6896a87116c2522734efd (diff) | |
download | tdelibs-7abcdb6683ea49819e25f88536f38076264869a6.tar.gz tdelibs-7abcdb6683ea49819e25f88536f38076264869a6.zip |
Add core number to CPU information structure
Diffstat (limited to 'tdecore/tdehardwaredevices.cpp')
-rw-r--r-- | tdecore/tdehardwaredevices.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp index 8dc208f0c..225788b7f 100644 --- a/tdecore/tdehardwaredevices.cpp +++ b/tdecore/tdehardwaredevices.cpp @@ -876,6 +876,10 @@ bool TDEStorageDevice::unmountDevice(TQString* errRet, int* retcode) { } TDECPUDevice::TDECPUDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { + m_frequency = -1; + m_minfrequency = -1; + m_maxfrequency = -1; + m_corenumber = -1; } TDECPUDevice::~TDECPUDevice() { @@ -953,6 +957,10 @@ void TDECPUDevice::internalSetAvailableGovernors(TQStringList gp) { m_governers = gp; } +void TDECPUDevice::internalSetCoreNumber(int cn) { + m_corenumber = cn; +} + bool TDECPUDevice::canSetGovernor() { TQString governornode = systemPath() + "/cpufreq/scaling_governor"; int rval = access (governornode.ascii(), W_OK); @@ -1001,6 +1009,10 @@ void TDECPUDevice::setMaximumScalingFrequency(double fr) { KGlobal::hardwareDevices()->processModifiedCPUs(); } +int TDECPUDevice::coreNumber() { + return m_corenumber; +} + TDESensorDevice::TDESensorDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { } @@ -2077,6 +2089,10 @@ void TDEHardwareDevices::processModifiedCPUs() { curline = curline.stripWhiteSpace(); processorNumber = curline.toInt(); if (!cdevice) cdevice = dynamic_cast<TDECPUDevice*>(findBySystemPath(TQString("/sys/devices/system/cpu/cpu%1").arg(processorNumber))); + if (cdevice) { + if (cdevice->coreNumber() != processorNumber) modified = true; + cdevice->internalSetCoreNumber(processorNumber); + } } if (curline.startsWith("model name")) { curline.remove(0, curline.find(":")+1); @@ -2147,6 +2163,8 @@ void TDEHardwareDevices::processModifiedCPUs() { cdevice = dynamic_cast<TDECPUDevice*>(findBySystemPath(TQString("/sys/devices/system/cpu/cpu%1").arg(processorNumber))); if (cdevice) { // Set up CPU information structures + if (cdevice->coreNumber() != processorNumber) modified = true; + cdevice->internalSetCoreNumber(processorNumber); if (cdevice->name() != modelName) modified = true; cdevice->internalSetName(modelName); if (cdevice->vendorName() != vendorName) modified = true; |