diff options
author | root <root@rshg054.dnsready.net> | 2012-01-15 23:14:56 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-01-15 23:14:56 +0000 |
commit | 0b31296d95d2e0f18abf69f30d0946e3a1f35672 (patch) | |
tree | d7348183933db628f7b6be4d50c4c763c50cd71e /community/linux-tools | |
parent | 2d4aa7f882dac8abb34e973655326c93f584f31f (diff) |
Sun Jan 15 23:14:55 UTC 2012
Diffstat (limited to 'community/linux-tools')
-rw-r--r-- | community/linux-tools/PKGBUILD | 27 | ||||
-rw-r--r-- | community/linux-tools/cpupower.conf | 28 | ||||
-rw-r--r-- | community/linux-tools/cpupower.rc | 32 | ||||
-rw-r--r-- | community/linux-tools/cpupower.service | 10 |
4 files changed, 67 insertions, 30 deletions
diff --git a/community/linux-tools/PKGBUILD b/community/linux-tools/PKGBUILD index 345d8f9ad..026c0aa1d 100644 --- a/community/linux-tools/PKGBUILD +++ b/community/linux-tools/PKGBUILD @@ -1,12 +1,12 @@ -# $Id: PKGBUILD 61664 2012-01-06 00:12:09Z seblu $ -# Maintainer: Sebastien Luttringer <seblu+arch@seblu.net> +# $Id: PKGBUILD 62053 2012-01-15 02:27:29Z seblu $ +# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org> pkgbase=linux-tools pkgname=('perf' 'cpupower') pkgver=3.2 -kernver=${pkgver} +kernver=${pkgver}.1 [[ ${kernver##*rc} != $kernver ]] && testing='testing' -pkgrel=1 +pkgrel=2 license=('GPL2') arch=('i686' 'x86_64') url='http://www.kernel.org' @@ -16,16 +16,18 @@ makedepends=('asciidoc' 'xmlto') makedepends+=('python2' 'libnewt' 'elfutils' 'pciutils') source=("http://ftp.kernel.org/pub/linux/kernel/v3.0/$testing/linux-$kernver.tar.xz" 'cpupower.rc' - 'cpupower.conf') -md5sums=('364066fa18767ec0ae5f4e4abcf9dc51' - 'd8b119eff7dc1a2d655eb71a47fa6215' - '218fd36a7957d3170ed8bd1a0be1f62f') + 'cpupower.conf' + 'cpupower.service') +md5sums=('cd2f8b7752c85c337af809391f4afb94' + '26af384ca282bc0dc38ff65acc7bb4b9' + '857ccdd0598511e3bf4b63522754dc48' + '20870541e88109d2f153be3c58a277f1') build() { msg2 'Build perf' cd linux-$kernver/tools/perf - make PYTHON=python2 DESTDIR="${pkgdir}/usr" perfexecdir="lib/$pkgname" PERF_VERSION=$pkgver-$pkgrel \ - all man + make PYTHON=python2 DESTDIR="${pkgdir}/usr" perfexecdir="lib/$pkgname" \ + PERF_VERSION=$pkgver-$pkgrel all man msg2 'Build cpupower' # we cannot use --as-needed @@ -39,8 +41,8 @@ package_perf() { depends=('python2' 'libnewt' 'elfutils') cd linux-${kernver}/tools/perf - make PYTHON=python2 DESTDIR="${pkgdir}/usr" perfexecdir="lib/$pkgname" PERF_VERSION=$pkgver \ - install install-man + make PYTHON=python2 DESTDIR="${pkgdir}/usr" perfexecdir="lib/$pkgname" \ + PERF_VERSION=$pkgver install install-man } package_cpupower() { @@ -52,6 +54,7 @@ package_cpupower() { # install rc.d script install -D -m 755 cpupower.rc "$pkgdir/etc/rc.d/cpupower" install -D -m 644 cpupower.conf "$pkgdir/etc/conf.d/cpupower" + install -D -m 644 cpupower.service "$pkgdir/lib/systemd/system/cpupower.service" cd linux-$kernver/tools/power/cpupower make \ diff --git a/community/linux-tools/cpupower.conf b/community/linux-tools/cpupower.conf index 0f56836b1..ee8602953 100644 --- a/community/linux-tools/cpupower.conf +++ b/community/linux-tools/cpupower.conf @@ -1,14 +1,28 @@ -# valid governors: -# ondemand, performance, powersave, -# conservative, userspace -#governor="ondemand" +# Define CPUs governor +# valid governors: ondemand, performance, powersave, conservative, userspace. +#governor='ondemand' -# limit frequency range (optional) -# valid suffixes: Hz, kHz (default), MHz, GHz, THz +# Limit frequency range +# Valid suffixes: Hz, kHz (default), MHz, GHz, THz #min_freq="2.25GHz" #max_freq="3GHz" -# use freq to set up the exact cpu frequency using it with userspace governor +# Specific frequency to be set. +# Requires userspace governor to be available and loaded. #freq= +# Utilizes cores in one processor package/socket first before processes are +# scheduled to other processor packages/sockets. +# See man (1) CPUPOWER-SET for additional details. +#mc_scheduler= + +# Utilizes thread siblings of one processor core first before processes are +# scheduled to other cores. See man (1) CPUPOWER-SET for additional details. +#smp_scheduler= + +# Sets a register on supported Intel processore which allows software to convey +# its policy for the relative importance of performance versus energy savings to +# the processor. See man (1) CPUPOWER-SET for additional details. +#perf_bias= + # vim:set ts=2 sw=2 ft=sh et: diff --git a/community/linux-tools/cpupower.rc b/community/linux-tools/cpupower.rc index 812637b61..9b0bcddb7 100644 --- a/community/linux-tools/cpupower.rc +++ b/community/linux-tools/cpupower.rc @@ -8,19 +8,29 @@ case "$1" in start|restart) stat_busy "Setting cpupower rules" + declare -i fail=0 - declare params='' - if [[ "$governor" ]]; then - params="-g $governor " - params+="${min_freq:+-d $min_freq} " - params+="${max_freq:+-u $max_freq} " - params+="${freq:+-f $freq} " - cpupower frequency-set $params >/dev/null || { stat_fail; exit 1; } - stat_done - else - stat_append ': Invalid configuration' - stat_fail + # frequency-set options + declare -a params=() + params+=(${governor:+-g $governor}) + params+=(${min_freq:+-d $min_freq}) + params+=(${max_freq:+-u $max_freq}) + params+=(${freq:+-f $freq}) + if ((${#params[@]} > 0)); then + cpupower frequency-set "${params[@]}" >/dev/null || fail=1 fi + + # set options + declare -a params=() + params+=(${mc_scheduler:+-m $mc_scheduler}) + params+=(${smp_scheduler:+-s $smp_scheduler}) + params+=(${perf_bias:+-b $perf_bias}) + if ((${#params[@]} > 0)); then + cpupower set "${params[@]}" >/dev/null || fail=1 + fi + + # print failure if any + (($fail > 0)) && stat_fail && exit 1 || stat_done ;; *) echo "usage: $0 {start|restart}" diff --git a/community/linux-tools/cpupower.service b/community/linux-tools/cpupower.service new file mode 100644 index 000000000..f77cfdc97 --- /dev/null +++ b/community/linux-tools/cpupower.service @@ -0,0 +1,10 @@ +[Unit] +Description=Apply cpupower configuration + +[Service] +Type=oneshot +ExecStart=/etc/rc.d/cpupower start +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target |