CPUFreq addon in HAL
Holger Macht
hmacht at suse.de
Wed Jul 5 07:49:22 PDT 2006
Hi,
CPU frequency scaling is the last remaining important power management
technology that should be controllable from the desktop IMO, but that's
not possible yet. Or there's at least no common interface/ software
everybody agrees on.
Richard already proposed something similar in the past. His idea was to
control the different frequencies a CPU supports from higher level
applications on the desktop. His proposal was rejected, though.
So I'm doing a second apprach and I've got a different way of solving the
problem. It's implemented as a HAL addon which summarizes all cpufreq
capable CPUs into six DBus methods on the
org.freedesktop.Hal.Device.SystemPowerManagement interface.
Addon-cpufreq supports kernel governors and also implements a userspace
controlling mechanism. That makes it the "all you need for CPUFreq"
application. Furthermore, to not make things unnecessarily complicated for
desktop applications, it is supposed to abstract all the different
settings you can make for the different governors. One thing which isn't
available yet, is the possibility to control the performance of
dynamically scaled CPUs. There's a method to set the performance (from 1
to 100) which can be easily used from other applications with showing a
nice progress bar or the like. That makes it unique in contrast to former
solutions.
The biggest advantage is that you get CPUFreq out of the box on every
system supporting HAL without the need to install another daemon. Another
one is that desktop applications like gnome-power-manager or kpowersave
can use one common interface after all.
It claims the following DBus interfaces on the
/org/freedesktop/Hal/devices/computer device:
Set a specific CPU frequency governor
-------------------------------------
Interface: org.freedesktop.Hal.Device.SystemPowerManagement
Member : "SetCPUFreqGovernor"
Type : Method call with return
Param:
string : The governor to be set. This can be any arbitary string. Also
governors which are not known can be set
Return type:
int : 0 on success, 1 on error
Set the performance independently from the current governor
-----------------------------------------------------------
Interface: org.freedesktop.Hal.Device.SystemPowerManagement
Member : "SetCPUFreqPerformance"
Type : Method call with return
Param:
int : Value between 1 and 100. The higher the value the more
performance you get. 50 is default and should be sufficient
in most cases
Return type:
int : 0 on success, 1 on error or if performance settings are not
supported for the current governor
Set if niced processes should be consider when calculating CPU load
--------------------------------------------------------------------
Interface: org.freedesktop.Hal.Device.SystemPowerManagement
Member : "SetCPUFreqConsiderNice"
Type : Method call with return
Param:
boolean: True if niced processes should be considered, false otherwise
Return type:
int : 0 on success, 1 on error or if this setting is not supported
with the current governor
Get the current active governor
-------------------------------
Interface: org.freedesktop.Hal.Device.SystemPowerManagement
Member : "GetCPUFreqGovernor"
Type : Method call with return
Return type:
string : The current active governor
Get the current performance setting
-----------------------------------
Interface: org.freedesktop.Hal.Device.SystemPowerManagement
Member : "GetCPUFreqPerformance"
Type : Method call with return
Return type:
int : The current performance setting from 1 to 100
Get the current consider nice setting
-------------------------------------
Interface: org.freedesktop.Hal.Device.SystemPowerManagement
Member : "GetCPUFreqConsiderNice"
Type : Method call with return
Return type:
boolean: True if niced processes are considered, false otherwise
The addon basically consists of five parts:
1. One interface which contains all methods which are common for all
governors (see DBus interfaces above)
2. Some helper functions
3. The userspace governor implementation with the CPULoad calculation
mechanism
4. The ondemand governor implementation
5. DBus/HAL integration
Current addons only consist of one source file. However, I don't think
that makes sense for addon-cpufreq. If this would be a independent
project, I would have separated these parts into more different files. But
for now, I've just put the userspace part into two files (header, source)
and the remaining parts into another two files (header, source). It would
of course be possible to only have one source file and thus get rid of the
header files if this is desired.
I've appended a somewhat patch to accomplish all this. Please comment...
If you guys don't agree that this could be added to HAL as an addon, maybe
the above mentioned interfaces can be implemented by installing some
scripts like hal-system-power-cpufreq-set-governor. Then I'm trying to get
org.freedesktop.CPUFreq for a separate daemon and can call the DBus
methods inside them. All other people can then of course do whatever they
like in those scripts.
Regards,
Holger
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-addon-cpufreq.patch
Type: text/x-patch
Size: 51042 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20060705/287e9a22/hal-addon-cpufreq-0001.bin
More information about the hal
mailing list