summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/powernowd/README61
-rw-r--r--system/powernowd/doinst.sh22
-rw-r--r--system/powernowd/powernowd.1108
-rw-r--r--system/powernowd/powernowd.SlackBuild36
-rw-r--r--system/powernowd/powernowd.info12
-rw-r--r--system/powernowd/rc.powernowd.new54
-rw-r--r--system/powernowd/slack-desc14
7 files changed, 85 insertions, 222 deletions
diff --git a/system/powernowd/README b/system/powernowd/README
index 3014a4bcc5..2db8eef6bc 100644
--- a/system/powernowd/README
+++ b/system/powernowd/README
@@ -1,12 +1,57 @@
+Overview:
This is a very simple program that will adjust the speed of your CPU
depending on system load. It works as a client of the CPUFreq driver.
-It is designed for use with CPU's supporting AMD's PowerNow power
-management scheme, as it's algorithm works better if there are more
-than two CPU speeds available. (aka, ARM, AMD K6/K7, Via C3, and
-Crusoe as opposed to traditional Intel and Ultrasparc).
+It is designed for use with CPU's supporting AMD's PowerNow power management
+scheme, as it's algorithm works better if there are more then two CPU
+speeds available. (aka, ARM, AMD K6/K7, Via C3, and Crusoe as opposed to
+traditional Intel and Ultrasparc).
-Powernowd uses the userspace governor, which is included in the Slackware
-kernel images.
+This program is essentially a simple client to the CPUFreq sysfs interface.
+This means that you -need- to be running Linux v2.5 or later that includes
+the sysfs interface. This daemon will -not- work with the CPUFreq driver
+interface included in Linux v2.4. Feel free to write your own daemon
+to support that if you like; you can even use this as a starting point.
+If there's enough clamoring for it, then maybe I'll whip up something.
+You also need a CPU that supports frequency scaling and supports the CPUFreq
+interface. This code has been tested on various AMD and PPC processors
-It is not wise to run two concurrent cpu frequency adjusting programs,
-for example, cpufreqd and powernowd simultaneously.
+I have been running this daemon on my AMD laptop for over 2 years with no
+problems to report, and it's nice that my laptop remains cool unless I'm
+really doing something intensive, like watching DivX movies, without me
+having to manually intervene and set the speed. I just recently bought an
+Apple iBook G3, and powernowd-0.80 worked flawlessly on it right out of
+the box.
+
+
+Features:
+
+This daemon's goal is simplicity and speed. It doesn't try and make
+too many decisions for you. That's its beauty, but it may not be what
+everyone's looking for. Some of the features this daemon has:
+
+One, simple heuristic to determine CPU load: "user + sys" time.
+Ignore "niced" programs (setiathome, itself, etc). In my mind this is
+consistent with what is meant when someone 'nice's a program to begin
+with. (configurable in v0.85+) Designed for CPU's that support more
+then two speed states, but works well with anything. Very fast, low
+overhead /proc/stat gathering (method stolen from procps). Supports SMP
+Will automatically switch to 'userspace' governor. Care taken to make
+the code non-root exploitable (but please audit for yourself first!)
+Frequency step size is configurable (default to 100MHz/step) 4 different
+behavioral modes to choose from (SINE, AGGRESSIVE, PASSIVE, LEAPS),
+which determine the behavior when the load changes. Configurable from the
+command line. Written in C for speed and simplicity. Logging to stdout
+or syslog Configurable Polling frequency in milliseconds (defaults to 1s)
+Configurable highwater/lowwater marks for CPU usage. (defaults 80/20%)
+
+Many similar daemons use other methods to determine what speed to use,
+such as battery status, AC status, temperature, fan status, etc. They all
+have their place. I however feel that in the grand scheme of things none
+of the above matters. When I'm not using my CPU, I don't care if it's
+running at a slower speed. When I -am- using my CPU, I only need it to
+be fast enough to handle the task at hand without hiccuping. And when I'm
+taxing my CPU, I want it running full speed. That's all this daemon does,
+monitor CPU load and adjust the speed accordingly. Since in all reality
+my CPU is idle 99% of the time (or playing mp3's which it can easily do
+at it's lowest speed rating), this by definition leads to low power usage,
+low temperatures, low speed fans, and better battery life.
diff --git a/system/powernowd/doinst.sh b/system/powernowd/doinst.sh
deleted file mode 100644
index 4fdea56905..0000000000
--- a/system/powernowd/doinst.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-config() {
- NEW="$1"
- OLD="$(dirname $NEW)/$(basename $NEW .new)"
- # If there's no config file by that name, mv it over:
- if [ ! -r $OLD ]; then
- mv $NEW $OLD
- elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
- # toss the redundant copy
- rm $NEW
- fi
- # Otherwise, we leave the .new copy for the admin to consider...
-}
-
-# Keep same perms on rc.powernowd.new:
-if [ -e etc/rc.d/rc.powernowd ]; then
- cp -a etc/rc.d/rc.powernowd etc/rc.d/rc.powernowd.new.incoming
- cat etc/rc.d/rc.powernowd.new > etc/rc.d/rc.powernowd.new.incoming
- mv etc/rc.d/rc.powernowd.new.incoming etc/rc.d/rc.powernowd.new
-fi
-
-config etc/rc.d/rc.powernowd.new
-
diff --git a/system/powernowd/powernowd.1 b/system/powernowd/powernowd.1
deleted file mode 100644
index 232c990f8d..0000000000
--- a/system/powernowd/powernowd.1
+++ /dev/null
@@ -1,108 +0,0 @@
-.\" Hey, EMACS: -*- nroff -*-
-.\" First parameter, NAME, should be all caps
-.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
-.\" other parameters are allowed: see man(7), man(1)
-.TH POWERNOWD 1 "November 3, 2003"
-.\" Please adjust this date whenever revising the manpage.
-.\"
-.\" Some roff macros, for reference:
-.\" .nh disable hyphenation
-.\" .hy enable hyphenation
-.\" .ad l left justify
-.\" .ad b justify to both left and right margins
-.\" .nf disable filling
-.\" .fi enable filling
-.\" .br insert line break
-.\" .sp <n> insert n+1 empty lines
-.\" for manpage-specific macros, see man(7)
-.SH NAME
-powernowd \- control the speed and voltage of cpus
-.SH SYNOPSIS
-.B powernowd
-.RI [ options ]
-.SH DESCRIPTION
-This is a simple client to the cpufreq driver, and uses the sysfs interface
-in Linux kernel version 2.6. You need a supported cpu, and a
-kernel that supports sysfs to run this daemon.
-
-The name is somewhat misleading, as any processor supported by the kernel
-cpufreq driver will work, not just processors supporting AMD's
-PowerNow! technology. This daemon works best with processors that support
-more then 2 frequency steps, like those with AMD's PowerNow!, and Intel's
-Pentium M family.
-.SH OPTIONS
-.TP
-.B \-h
-Prints a help message.
-.TP
-.B \-d
-Don't detach from terminal (default is to detach and run in the background)
-.TP
-.B \-v
-Increase output verbosity, can be used more than once.
-.TP
-.B \-q
-Quiet mode, only emergency output.
-.TP
-.B \-n
-Include nice'd processes in calculations.
-.TP
-.B \-m
-Modes of operation, 0 = SINE, 1 = AGGRESSIVE (default), 2 = PASSIVE, 3 = LEAPS
-.TP
-.B \-s
-Frequency step in kHz (default = 100000)
-.TP
-.B \-p
-Polling frequency in msecs (default = 1000)
-.TP
-.B \-u
-CPU usage upper limit percentage [0 .. 100, default 80]
-.TP
-.B \-l
-CPU usage lower limit percentage [0 .. 100, default 20]
-.SH MODES
-There are 4 modes supported by this client:
-
-Mode 0, SINE, changes the frequency as a sine wave function, raising the
-frequency by "step" Hz every time the CPU usage goes over 80%,
-and decreases it by "step" Hz when the CPU usage falls under 20%.
-
-Mode 1, AGGRESSIVE, changes frequency by a sawtooth function.
-Immediately jumps to the highest frequency whenever CPU usage goes
-over 80%, and decreases by "step" Hz as usage drops below
-20%. This is the default behavior.
-
-Mode 2, PASSIVE, is the inverse of AGGRESSIVE.
-Immediately jump to lowest frequency when usage drops below 20%.
-Raise by "step" Hz if it goes above 80%.
-
-Mode 3, LEAPS, immediately jumps to the highest frequency if usage is above
-80%, and immediately jumps to the lowest frequency if usage is below 20%.
-.SH PHILOSOPHY
-Why another CPUFreq client daemon?
-
-Some other daemons are better suited for two speed states, and
-toggle between two states based upon load. This daemon does a better job
-handling intermediate steps.
-
-Other daemons are written in Perl, Python, or C++. This is a simple C
-program.
-
-Some other daemons rely on APM or ACPI.
-The sysfs interface to the 2.6
-kernel is simple, completely sufficient, and completely portable to all
-architectures that support the CPUfreq support in the kernel.
-
-Some other daemons change thier behavior based upon battery status, AC
-status, temperature, etc. What good is having a nice powerful laptop if
-you can't use it at full speed, even for a few seconds, while on battery
-power? This daemon just measures CPU load, and bases decisions solely
-upon that.
-
-SMP systems are supported, making this daemon useful for servers, too!
-.SH AUTHOR
-The powernowd program was written by John Clemens <clemej@alum.rpi.edu>
-
-This manual page was written by Bdale Garbee <bdale@gag.com>,
-for the Debian project (but may be used by others).
diff --git a/system/powernowd/powernowd.SlackBuild b/system/powernowd/powernowd.SlackBuild
index 8671a5a2ad..443d735a98 100644
--- a/system/powernowd/powernowd.SlackBuild
+++ b/system/powernowd/powernowd.SlackBuild
@@ -2,7 +2,7 @@
# Slackware build script for powernowd
-# Written by Daniel LEVAI leva@ecentrum.hu
+# Written by David Woodfall info@davidwoodfall.co.uk
PRGNAM=powernowd
VERSION=${VERSION:-1.00}
@@ -17,16 +17,19 @@ OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
fi
-set -e # Exit on most errors
+set -e
rm -rf $PKG
-mkdir -p $TMP $PKG $OUTPUT
+mkdir -p $TMP $OUTPUT $PKG/usr/sbin
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
@@ -38,28 +41,25 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
-# We'll do all of this manually
-gcc $SLKCFLAGS -Wall -o powernowd powernowd.c
+make
+install -m 755 powernowd $PKG/usr/sbin
-mkdir -p $PKG/usr/sbin
-strip --strip-unneeded powernowd
-install -m 755 powernowd $PKG/usr/sbin/
-
-mkdir -p $PKG/etc/rc.d/
-cat $CWD/rc.powernowd.new > $PKG/etc/rc.d/rc.powernowd.new
-
-mkdir -p $PKG/usr/man/man1
-gzip -9c $CWD/powernowd.1 > $PKG/usr/man/man1/powernowd.1.gz
+( cd $PKG
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null || true
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null || true
+)
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
- README \
- $PKG/usr/doc/$PRGNAM-$VERSION
+ powernowd.init \
+ $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
-cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+
diff --git a/system/powernowd/powernowd.info b/system/powernowd/powernowd.info
index 8e21b7779c..e1b16cc1db 100644
--- a/system/powernowd/powernowd.info
+++ b/system/powernowd/powernowd.info
@@ -1,8 +1,10 @@
PRGNAM="powernowd"
VERSION="1.00"
-HOMEPAGE="http://deater.net/john/powernowd.html"
-DOWNLOAD="http://deater.net/john/powernowd-1.00.tar.gz"
+HOMEPAGE="http://www.deater.net/john/powernowd.html"
+DOWNLOAD="http://www.deater.net/john/powernowd-1.00.tar.gz"
MD5SUM="abc48b690d104e9e71a85400ba19d799"
-MAINTAINER="Daniel LEVAI"
-EMAIL="leva@ecentrum.hu"
-APPROVED="rworkman"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="David Woodfall"
+EMAIL="info@davidwoodfall.co.uk"
+APPROVED="dsomero"
diff --git a/system/powernowd/rc.powernowd.new b/system/powernowd/rc.powernowd.new
deleted file mode 100644
index fe6f50f15e..0000000000
--- a/system/powernowd/rc.powernowd.new
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-
-# Written by Daniel LEVAI for the Slackware package
-# Modified by Robby Workman <rworkman@slackbuilds.org>
-
-# For the options, see the README of the man page
-#OPTS='-q'
-
-powernowd_start() {
- local PID=$(pgrep -x powernowd);
- if [ $PID ];then
- echo "powernowd is already running ($PID)"
- exit 1
- else
- /usr/sbin/powernowd $OPTS
- fi
-}
-
-powernowd_stop() {
- local PID=$(pgrep -x powernowd);
- if [ -z $PID ];then
- echo "powernowd is not running"
- exit 1
- else
- local i=1
- while pgrep -x powernowd > /dev/null;do
- if [ $i -gt 3 ];then
- echo "Couldn't stop powernowd..."
- exit 1
- fi
- pkill -x powernowd
- i=$(( $i + 1 ));
- sleep 1;
- done
- fi
-}
-
-case "$1" in
-start)
- powernowd_start
-;;
-stop)
- powernowd_stop
-;;
-restart)
- powernowd_stop
- sleep 1
- powernowd_start
-;;
-*)
- echo "$0 <start|stop|restart>"
-;;
-esac
-
diff --git a/system/powernowd/slack-desc b/system/powernowd/slack-desc
index 0ee78d0492..83ac7469f0 100644
--- a/system/powernowd/slack-desc
+++ b/system/powernowd/slack-desc
@@ -5,15 +5,15 @@
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
- |-----handy-ruler-------------------------------------------------------|
-powernowd: This is a very simple program that will adjust the speed of your CPU
+ |-----handy-ruler------------------------------------------------------|
+powernowd: powernowd (a cpu frequency daemon)
+powernowd:
+powernowd: This is a very simple program that will adjust the speed of your CPU
powernowd: depending on system load. It works as a client of the CPUFreq driver.
-powernowd: It is designed for use with CPU's supporting AMD's PowerNow power
-powernowd: management scheme, as it's algorithm works better if there are more
-powernowd: then two CPU speeds available. (aka, ARM, AMD K6/K7, Via C3, and
+powernowd: It is designed for use with CPU's supporting AMD's PowerNow power
+powernowd: management scheme, as it's algorithm works better if there are more
+powernowd: then two CPU speeds available. (aka, ARM, AMD K6/K7, Via C3, and
powernowd: Crusoe as opposed to traditional Intel and Ultrasparc).
powernowd:
-powernowd: http://deater.net/john/powernowd.html
-powernowd:
powernowd:
powernowd: