#5 Additional plugin to delay Rules

open
nobody
None
5
2006-02-27
2006-02-27
Heiko Noordhof
No

This patch is against cpufreqd-2.0.0.

It adds a plugin that supports delaying a Rule before
it will actually
be applied.

Example:

[Rule]
name=AC on
profile=OnDemand
ac=on
delay=7 # This Rule will not be applied until
hit 7 polls.
[/Rule]

This required the plugin to be able to prevent a rule
from being
applied. Therefore this patch also changes main.c and
cpufreqd_plugin.h to support this.

The following keyword call-back functions need to
return an int
instead of void:
profile_pre_change
profile_post_change
rule_pre_change
rule_post_change

In 2.0.0 only the following plugins use (one of) these
function(s) and
are patched also to return int from these functions:
nforce2 &
nvclock.

The return values from the ..._post_change functions
are ignored, but
the ..._pre_change functions can return non-zero to
(temporarily)
prevent the rule or profile from actually take effect.

This patch creates this file:
src/cpufreqd_delay.c

and changes the following files:
configure.in
src/Makefile.am
src/cpufreqd_plugin.h
src/main.c
cpufreqd_nforce2.c
cpufreqd_nvclock.c

To apply the patch:
cd cpufreqd-2.0.0
patch -p1 < /path/to/add_delay_plugin.patch

To create a new configure script to support the plugin:
# Make sure the (proper versions of) the autotools are
# installed. Then run:
./prepare.sh

To compile with the plugin:
./configure --enable-delay
make

Need to reinstall to be able to load the added plugin:
su -c "make install"

Comments, suggestions, patches and bug-reports will be
appreciated.

Discussion

  • Heiko Noordhof
    Heiko Noordhof
    2006-02-27

    Rule-delay plugin patch