summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tdecore/tdehardwaredevices.cpp18
-rw-r--r--tdecore/tdehardwaredevices.h12
2 files changed, 30 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;
diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h
index 907cdb65b..1f87301c5 100644
--- a/tdecore/tdehardwaredevices.h
+++ b/tdecore/tdehardwaredevices.h
@@ -801,6 +801,11 @@ class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice
*/
void setMaximumScalingFrequency(double fr);
+ /**
+ * @return an integer with the core number, starting at 0
+ */
+ int coreNumber();
+
protected:
/**
* @param fr a double with the current CPU frequency in MHz, if available
@@ -856,6 +861,12 @@ class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice
*/
void internalSetAvailableGovernors(TQStringList gp);
+ /**
+ * @param cn an integer with the core number, starting at 0
+ * @internal
+ */
+ void internalSetCoreNumber(int cn);
+
private:
double m_frequency;
double m_minfrequency;
@@ -866,6 +877,7 @@ class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice
TQStringList m_tiedprocs;
TQStringList m_frequencies;
TQStringList m_governers;
+ int m_corenumber;
friend class TDEHardwareDevices;
};