mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-03 13:07:13 +08:00
adding cpupower, will be replacement of cpu-frequtils evenually
This commit is contained in:
parent
eaf1bbe142
commit
640f38d556
48
cpupower/PKGBUILD
Normal file
48
cpupower/PKGBUILD
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# Platform Packages for Chakra, part of chakra-project.org
|
||||
#
|
||||
# maintainer abveritas@chakra-project.org
|
||||
|
||||
pkgname=cpupower
|
||||
pkgver=3.4
|
||||
pkgrel=1
|
||||
pkgdesc='Linux kernel tool to examine and tune power saving related features of your processor'
|
||||
license=('GPL2')
|
||||
arch=('i686' 'x86_64')
|
||||
url='http://www.kernel.org'
|
||||
depends=('pciutils')
|
||||
makedepends=('asciidoc' 'xmlto')
|
||||
conflicts=('cpufrequtils')
|
||||
backup=('etc/conf.d/cpupower')
|
||||
options=('!strip')
|
||||
source=("http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$pkgver.tar.xz"
|
||||
'cpupower.rc'
|
||||
'cpupower.conf'
|
||||
'cpupower.service')
|
||||
md5sums=('967f72983655e2479f951195953e8480'
|
||||
'ad84b0bf8459cac1de9de9241b5ae017'
|
||||
'fb4b3d184850f5972c5a1bba3ead4e05'
|
||||
'20870541e88109d2f153be3c58a277f1')
|
||||
|
||||
build() {
|
||||
pushd linux-$pkgver/tools/power/cpupower
|
||||
|
||||
LDFLAGS=${LDFLAGS:+"$LDFLAGS,--no-as-needed"}
|
||||
make VERSION=$pkgver-$pkgrel
|
||||
popd
|
||||
}
|
||||
|
||||
package() {
|
||||
pushd linux-$pkgver/tools/power/cpupower
|
||||
make \
|
||||
DESTDIR="$pkgdir" \
|
||||
mandir='/usr/share/man' \
|
||||
docdir='/usr/share/doc/cpupower' \
|
||||
install install-man
|
||||
popd
|
||||
|
||||
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/usr/lib/systemd/system/cpupower.service"
|
||||
}
|
||||
|
26
cpupower/cpupower.conf
Normal file
26
cpupower/cpupower.conf
Normal file
@ -0,0 +1,26 @@
|
||||
# Define CPUs governor
|
||||
# valid governors: ondemand, performance, powersave, conservative, userspace.
|
||||
#governor='ondemand'
|
||||
|
||||
# Limit frequency range
|
||||
# Valid suffixes: Hz, kHz (default), MHz, GHz, THz
|
||||
#min_freq="2.25GHz"
|
||||
#max_freq="3GHz"
|
||||
|
||||
# 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=
|
40
cpupower/cpupower.rc
Normal file
40
cpupower/cpupower.rc
Normal file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /etc/rc.conf
|
||||
. /etc/rc.d/functions
|
||||
|
||||
[[ -f /etc/conf.d/cpupower ]] && . /etc/conf.d/cpupower
|
||||
|
||||
case "$1" in
|
||||
start|restart)
|
||||
stat_busy "Setting cpupower rules"
|
||||
declare -i fail=0
|
||||
|
||||
# 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}"
|
||||
esac
|
||||
|
||||
true
|
||||
|
10
cpupower/cpupower.service
Normal file
10
cpupower/cpupower.service
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user