On Sunday 09 of March 2014 00:31:20 François Andriot wrote:
Hello,
I've been instigating the CPU wasting issue in tdepowersave as well.
I've found out that the CPU cycles are mostly eaten by the TDEHW
library, not in tdepowersave itself.
See: tdelibs/tdecore/tdehw/tdehardwaredevice.cpp
At line 244 and 246, you can see that there are 2 timers that are
initialized.
The 1st timer is used to poll for CPU-related changes every 500ms.
It triggers a function line 409:
void TDEHardwareDevices::processModifiedCPUs()
The 2nd timer ise used to poll other-devices changes every 1000ms.
It triggers a function line 740:
void TDEHardwareDevices::processStatelessDevices()
After tracing, it looks like the 2nd timer is the most CPU-eating.
It basically rescans all hardware devices of the computer !
On the other side, as you have found, tdepowersave receives notification
for every device in the system, and must filter the interesting one
(cpu-related or battery-related).
I think there are 2 different solutions here:
1) find a way to remove the periodic polling and use notifications from
kernel instead (but how ?)
2) optimize the polling code so that it eats less CPU
Yes, that's exactly what I mentioned in other thread - mail
http://trinity-devel.pearsoncomputing.net/?0::13193
For input event devices such periodic rescan now represent dbus call to check
the status of switches. Find ways to solution listed as 1) would be good.
--
Slavek