Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 37425 - A little script to control CPU throttle -> It would be cool to add this to KLaptop! (KDE)
Summary: A little script to control CPU throttle -> It would be cool to add this to KL...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] KDE (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-06 15:17 UTC by Rene Androsch
Modified: 2004-01-09 10:55 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rene Androsch 2004-01-06 15:17:47 UTC
After realising that
/proc/acpi/processor/CPU1/performance
and
/proc/acpi/processor/CPU1/power
is not supported on my notebook (Gericom X5 Force, Pentium 4 Mobile CPU [not Centrino, but Speedstep enabled]), I found out, that
/proc/acpi/processor/CPU1/throttling
works very well and can be changed!

So I wrote a little script to switch up and down CPU throttling (cpu_switch). I testet it with a small PHP script. (pbench)

Here are the results for my notebook:
100% 1m55.254
47% 4m2.310
7% 22m25.512

So it seems to do something :)

cpu_switch:
--------start--------
#!/bin/sh
cpu="/proc/acpi/processor/CPU1/throttling"
cur_t=`cat $cpu | grep "*" | cut -dT -f2 | cut -d: -f1`
min_t=`cat $cpu | grep "T*%" | head -n 1 | tr -d "*" | cut -d: -f1 | cut -dT -f2`
max_t=`cat $cpu | grep "T*%" | tail -n 1 | tr -d "*" | cut -d: -f1 | cut -dT -f2`

#echo "cur: " $cur_t
#echo "min: " $min_t
#echo "max: " $max_t

msg1="Switching to "
msg2="Switching one step "

err=1
if [ "$1" == "" ];
then
        err=1
else
        if [ "$1" == "fastest" ];
        then
                err=0
                echo $msg1 $1
                echo $min_t > $cpu
        fi

        if [ "$1" == "slowest" ];
        then
                err=0
                echo $msg1 $1
                echo $max_t > $cpu
        fi

        if [ "$1" == "slower" ];
        then
                err=0
                new=$(($cur_t+1))
                if [ $new -gt $max_t ];
                then
                        new=$max_t
                fi
                p=$((100 - $new * 100 / $max_t))
                echo $msg2 $1 "($p%)"
                echo $new > $cpu
        fi

        if [ "$1" == "faster" ];
        then
                err=0
                new=$(($cur_t-1))
                if [ $new -lt $min_t ];
                then
                        new=$min_t
                fi
                p=$((100 - $new * 100 / $max_t))
                echo $msg2 $1 "($p%)"
                echo $new > $cpu
        fi
fi
if [ $err == 1 ];
then
        echo "$0 <fastest | slowest | faster | slower>";
        p=$((100 - $cur_t * 100 / $max_t))
        echo "Currently running at $p%"
fi
---------end---------


pbench (time php pbench):
--------start--------
<?php
$outer=1000;
$inner=10000;
for ($i = 0; $i < $outer; $i++)
{
        for ($j = 0; $j < $inner; $j++)
        {
                $a = $i + $j;
                $b = $outer - $i;
                $c = $inner - $j;
                $d = $i * $j;
                $e = $i - $j;
                $f = $i / (1+$j);
                $g = $a + $b;
                $h = $c + $d;
                $k = $e + $f;
                $l = $g + $h;
                $m = $l + $k;
                $n = ((((($i*2)*4)*$j)*6)/13.86751);
        }
}
?>
---------end---------


It would be nice to have a something like this integrated in KLaptop, since I use this for my notebook.

It would be also nice, to have real speedstep control in the kernel. Suse 9.0 has it in the kernel + configuration tools, but it doesn't work with Pentium 4 Mobile CPU (which my notebook has).

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Caleb Tennis (RETIRED) gentoo-dev 2004-01-09 10:55:36 UTC
I apprecate the report, but for desired integration you should report it directly to the KDE team.