You are not logged in.

#1 2008-05-12 13:15:25

pfreire
Member
From: Portugal
Registered: 2008-05-12
Posts: 29

Powerthend - better cpu scalling

Hi, first of all let me congrat all the developers and community around Archlinux. I'm new to this distribution but I've been playing around with Linux for some years now.

Now my question, I've made a search and I could not find a thing about powerthend - no one until now tried this under Archlinux?

Offline

#2 2008-05-12 13:25:00

stefan1975
Member
From: 53 6e 65 65 6b
Registered: 2007-04-16
Posts: 195

Re: Powerthend - better cpu scalling

Hi,

well how good can it be since it has shit-in-its-name. No seriously. Anyway I never heard of it but it does look promising, I use the cpufrequtils in the Arch repos which suit me fine. You have any idea why this would be better?

You will probably get a lot of responses now that suggest you build-it-yourself if you want to use it though.

stefan


"root# su - bofh"
OS: F10_x64, Arch, Centos5.3, RHEL4.7, RHEL5.3
Desktop Hardware: Dell Precision M65 laptop, core2duo, 2gb, 80gb 7200rpm
Registered linux user #459910 since 1998

Offline

#3 2008-05-12 13:44:31

pfreire
Member
From: Portugal
Registered: 2008-05-12
Posts: 29

Re: Powerthend - better cpu scalling

Well it's better alright, I've been using it for more than 1 year and it delivers quicker response when some task needs more cpu. It's on my "to-do" list but I've just moved to Arch so I'm compiling/creating packages for what I need most:

- Virtualbox 1.6 is out, so I'll rebuild the new version if I can
- Google Earth package
- Powerthend (I call it that way but it's really PowerThen Daemon)
- idjc (something like Sam Broadcaster but for Linux)
- Krusader 1.90.0 (already compiled and working)

So, just give me some time before the flames about "do it yourself" because I sure will. Then I will Read The FM before contributing with something. wink

Offline

#4 2008-05-12 13:55:42

stefan1975
Member
From: 53 6e 65 65 6b
Registered: 2007-04-16
Posts: 195

Re: Powerthend - better cpu scalling

pfreire wrote:

Well it's better alright, I've been using it for more than 1 year and it delivers quicker response when some task needs more cpu. It's on my "to-do" list but I've just moved to Arch so I'm compiling/creating packages for what I need most:

- Virtualbox 1.6 is out, so I'll rebuild the new version if I can
- Google Earth package
- Powerthend (I call it that way but it's really PowerThen Daemon)
- idjc (something like Sam Broadcaster but for Linux)
- Krusader 1.90.0 (already compiled and working)

So, just give me some time before the flames about "do it yourself" because I sure will. Then I will Read The FM before contributing with something. wink

well as for virtualbox 1.6, people are already working to get it in AUR so you could wait/help there but I tried the generic linux i386 download .run file which runs fine on my Arch_i686 system even with my existing 1.5.6 virtual machines

stefan


"root# su - bofh"
OS: F10_x64, Arch, Centos5.3, RHEL4.7, RHEL5.3
Desktop Hardware: Dell Precision M65 laptop, core2duo, 2gb, 80gb 7200rpm
Registered linux user #459910 since 1998

Offline

#5 2008-05-12 14:00:28

pfreire
Member
From: Portugal
Registered: 2008-05-12
Posts: 29

Re: Powerthend - better cpu scalling

Thanks for pointing that out Stefan, I see that google earth is in AUR too.

Offline

#6 2008-05-12 14:17:43

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Powerthend - better cpu scalling

PKGBUILD:

# Contributor: Ramses de Norre <snip>

pkgname=powerthend
pkgver=1.1.1
pkgrel=1
pkgdesc="Daemon to control the speed and voltage of CPUs."
arch=(i686 x86_64)
url="http://powerthend.scheissname.de/"
license=('GPL2')
source=(http://powerthend.scheissname.de/sources/$pkgname-$pkgver.tar.gz)

build() {
  cd $startdir/src/$pkgname-$pkgver
  sed -i "s|/usr/sbin|$startdir/pkg/usr/sbin|g" Makefile
  install -d $startdir/pkg/usr/sbin
  make || return 1
  make install || return 1
  install -d $startdir/pkg/etc/rc.d
  install -m 755 -o root -g root powerthend.init $startdir/pkg/etc/rc.d/powerthend
}

md5sums=('fc99bb7d2d6fbcb6f11af4d0133d0c7e')

The init script isn't working though, manually starting the daemon does work.

EDIT: removed mail address.

Last edited by Ramses de Norre (2008-11-14 17:40:08)

Offline

#7 2008-05-12 14:30:26

pfreire
Member
From: Portugal
Registered: 2008-05-12
Posts: 29

Re: Powerthend - better cpu scalling

Thanks Ramses, the init scripts from zenwalk are quite good and I think it may be simple to adapt to Arch, since are you the maintainer can you have a look at this?
http://users.zenwalk.org/user-accounts/ … owerthend/

Offline

#8 2008-05-12 14:36:48

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Powerthend - better cpu scalling

pfreire wrote:

Thanks Ramses, the init scripts from zenwalk are quite good and I think it may be simple to adapt to Arch, since are you the maintainer can you have a look at this?
http://users.zenwalk.org/user-accounts/ … owerthend/

I'll look into that and I'll put the package in AUR. Thanks for the link wink

http://aur.archlinux.org/packages.php?ID=16937

Last edited by Ramses de Norre (2008-05-12 14:45:16)

Offline

#9 2008-05-12 22:26:36

pfreire
Member
From: Portugal
Registered: 2008-05-12
Posts: 29

Re: Powerthend - better cpu scalling

Ramses, how about something like this to the daemon script, do you think the detection can be done this way?

##!/bin/bash
## CPU Frequency scaling script
## Requires bc for status calculations
## $driver must be set for this to work

statpath=/sys/devices/system/cpu/cpu0/cpufreq

stats() {
    curfreq="$(cat ${statpath}/cpuinfo_cur_freq)"
    maxfreq="$(cat ${statpath}/cpuinfo_max_freq)"
    minfreq="$(cat ${statpath}/cpuinfo_min_freq)"
    maxscal="$(cat ${statpath}/scaling_max_freq)"
    minscal="$(cat ${statpath}/scaling_min_freq)"
    avafreq=($(cat ${statpath}/scaling_available_frequencies))
    driscal="$(cat ${statpath}/scaling_driver)"
    setscal="${statpath}/scaling_setspeed"
    pid="$(pidof powerthend)"
    
    echo ""
    echo -n "Daemon Running:"
    if [ -n "${pid}" ]; then
        echo -e "\t\t\bYes\n"
    else
        echo -e "\t\t\bNo\n"
    fi
    
    echo -n "Current Frequency:"
    echo -e "\t\b${curfreq:0:1}.${curfreq:1:2}ghz\n"
    
    echo -n "CPU Max:"
    echo -e "\t\t\b${maxfreq:0:1}.${maxfreq:1:2}ghz\n"
    
    echo -n "Scaling Max:"
    echo -e "\t\t\b${maxscal:0:1}.${maxscal:1:2}ghz\n"
    
    echo -n "CPU Min:"
    echo -e "\t\t\b${minfreq:0:1}.${minfreq:1:2}ghz\n"
    
    echo -n "Scaling Min:"
    echo -e "\t\t\b${minscal:0:1}.${minscal:1:2}ghz\n"
    
    echo -n "Avaliable Frequencies:"
    
    i=0
    unset damnhack
    while [ -n "${avafreq[$i]}" ]; do
        echo -e " ${damnhack}${avafreq[$i]:0:1}.${avafreq[$i]:1:2}ghz"
        damnhack="\t\t\t\b"
        let i++;
    done
    
    echo ""
    echo -n "Current Driver:"
    echo -e "\t\t\b${driscal}\n"
}

modcheck() {
    if [ -n "$(grep vendor /proc/cpuinfo | grep AMD)" ]; then
        for module in powernow-k6 powernow-k7 powernow-k8; do
            if [ -z "$( modprobe $module 2>&1 )" ]; then
                driver=${module}
                break
            fi
        done
    elif [ -n "$(grep vendor /proc/cpuinfo | grep Intel)" ]; then
        for module in p4-clockmod speedstep-centrino acpi-cpufreq; do
            if [ -z "$( modprobe $module 2>&1 )" ]; then
                driver=${module}
                break
            fi
        done
    fi
}

setspeed() {
    echo "${1}" > ${statpath}/scaling_setspeed
}

case ${1} in
    start|restart|dyn|low|high)
        killall -15 powerthend >& /dev/null
        modcheck
        case ${1} in
            start|restart|dyn)
                /usr/sbin/powerthend
                echo $(cat ${statpath}/cpuinfo_min_freq) > ${statpath}/scaling_min_freq
                echo $(cat ${statpath}/cpuinfo_max_freq) > ${statpath}/scaling_max_freq
                ;;
            low)
                setspeed $(cat ${statpath}/cpuinfo_min_freq)
                ;;
            high)
                setspeed $(cat ${statpath}/cpuinfo_max_freq)
                ;;
        esac
        ;;
    stop)
        killall -15 powerthend >& /dev/null
        setspeed $(cat ${statpath}/cpuinfo_max_freq)
        ;;
    status)
        modcheck
        stats
        ;;
    *)
        echo "Usage: (start|stop|dyn|low|high|restart|status)"
        ;;
esac

If so you have to include bc as dependency.

Offline

#10 2008-05-12 23:35:29

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Powerthend - better cpu scalling

I've included a modified version of the powernowd initscript, is there anything missing that I should add?

Offline

#11 2008-05-13 00:01:58

pfreire
Member
From: Portugal
Registered: 2008-05-12
Posts: 29

Re: Powerthend - better cpu scalling

We only need to use that and to have the dependency of "bc". Maybe you can also include an echo telling to add the service powerthend to rc.conf. I've been using that script and it works great, and the computer is more responsive than using cpufreq in my opinion (in xfce if you add the CPU frequency plugin you can see the difference).

Offline

#12 2008-05-14 15:47:26

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Powerthend - better cpu scalling

Does your complicated script have any significant improvements over the one I've included? If so I'll look into it smile
And I think people now about adding daemons to rc.conf, that's pretty obvious, isn't it?

Offline

#13 2008-05-14 16:47:03

Aaron
Member
From: PA, USA
Registered: 2007-12-19
Posts: 108
Website

Re: Powerthend - better cpu scalling

Is there a command for powerthend similar to cpufreq-info?

I just switched to powerthend but have no idea if it's working?

Offline

#14 2008-05-14 19:21:40

pfreire
Member
From: Portugal
Registered: 2008-05-12
Posts: 29

Re: Powerthend - better cpu scalling

With the script I proposed you have the "status" argument to check status, with the actual build script from AUR you have to do it with something like:

watch grep \"cpu MHz\" /proc/cpuinfo

Ramses, if you look at the script I proposed you'll see it's a complete one that installs the cpu governor module, get status of it, and let you control it more efficiently - the only bug I see is how it converts the speed:

/etc/rc.d/powerthend status

Daemon Running:        Yes

Current Frequency:    8.25ghz

CPU Max:        2.20ghz

Scaling Max:        2.20ghz

CPU Min:        2.75ghz

Scaling Min:        2.75ghz

Avaliable Frequencies: 2.75ghz
             5.50ghz
             8.25ghz
             1.10ghz
             1.37ghz
             1.65ghz
             1.92ghz
             2.20ghz

Current Driver:        p4-clockmod

Available frequencies should read:

Avaliable Frequencies: 275mhz
             550mhz
             825mhz
             1.10ghz
             1.37ghz
             1.65ghz
             1.92ghz
             2.20ghz

Offline

Board footer

Powered by FluxBB