From 7abcdb6683ea49819e25f88536f38076264869a6 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 11 Oct 2012 11:26:39 -0500 Subject: Add core number to CPU information structure --- tdecore/tdehardwaredevices.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tdecore/tdehardwaredevices.cpp') 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(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(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; -- cgit v1.2.1