summaryrefslogtreecommitdiffstats
path: root/src/hardware_cpu.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-15 17:42:29 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-15 17:42:29 -0500
commit3ec8230e9f10645de684b5e03471e293481183d7 (patch)
tree0a9f15fcc62fb8a0e84eb8270ff30262274f3f4c /src/hardware_cpu.cpp
parent82806a03ea419871940eb3c03c792f3ea15734d9 (diff)
downloadtdepowersave-3ec8230e9f10645de684b5e03471e293481183d7.tar.gz
tdepowersave-3ec8230e9f10645de684b5e03471e293481183d7.zip
Initial migration off of HAL
Diffstat (limited to 'src/hardware_cpu.cpp')
-rw-r--r--src/hardware_cpu.cpp33
1 files changed, 4 insertions, 29 deletions
diff --git a/src/hardware_cpu.cpp b/src/hardware_cpu.cpp
index 1473a6d..5847dd9 100644
--- a/src/hardware_cpu.cpp
+++ b/src/hardware_cpu.cpp
@@ -46,6 +46,8 @@ CPUInfo::CPUInfo() {
update_info_cpufreq_speed_changed = true;
numOfCPUs = -1;
+
+ m_hwdevices = KGlobal::hardwareDevices();
kdDebugFuncOut(trace);
}
@@ -60,35 +62,8 @@ CPUInfo::~CPUInfo() {
* Returns the total count of CPUs - _not_ the last CPU ID!
*/
int CPUInfo::getCPUNum() {
- kdDebugFuncIn(trace);
-
- int cpu_id=0;
- TQDir tmp_dir;
- TQString cpu_path = "/sys/devices/system/cpu/cpu0/";
-#ifdef FAKE_CPU
- cpu_path.prepend("/tmp/foo");
-#endif
-
- // let check if we support cpufreq in general
- if (tmp_dir.exists(tmp_dir.absFilePath(cpu_path + "cpufreq/scaling_cur_freq", true))) {
- cpuFreqHW = true;
- } else {
- cpuFreqHW = false;
- }
-
- TQString tmp_path = tmp_dir.absFilePath(cpu_path, true);
-
- while (tmp_dir.exists(tmp_path)) {
- int tmp = cpu_id;
-
- cpu_id++;
- cpu_path.replace(TQString::number(tmp), TQString::number(cpu_id));
- tmp_path = tmp_dir.absFilePath(cpu_path, true);
- }
-
- kdDebug() << "getCPUNum() return: '" << cpu_id << "'" << endl;
- kdDebugFuncOut(trace);
- return cpu_id;
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
+ return hwlist.count();
}
/*!