summaryrefslogtreecommitdiff
path: root/sys-power/cpupower/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-power/cpupower/files
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-power/cpupower/files')
-rw-r--r--sys-power/cpupower/files/cflags-strip.patch18
-rw-r--r--sys-power/cpupower/files/conf.d-r236
-rw-r--r--sys-power/cpupower/files/cpupower-frequency-set.service9
-rw-r--r--sys-power/cpupower/files/cpupower-frequency-set.service.conf2
-rw-r--r--sys-power/cpupower/files/init.d-r441
5 files changed, 106 insertions, 0 deletions
diff --git a/sys-power/cpupower/files/cflags-strip.patch b/sys-power/cpupower/files/cflags-strip.patch
new file mode 100644
index 000000000000..6e70fdf38b1c
--- /dev/null
+++ b/sys-power/cpupower/files/cflags-strip.patch
@@ -0,0 +1,18 @@
+--- a/Makefile
++++ b/Makefile
+@@ -180,14 +180,7 @@
+ endif
+ export QUIET ECHO
+
+-# if DEBUG is enabled, then we do not strip or optimize
+-ifeq ($(strip $(DEBUG)),true)
+- CFLAGS += -O1 -g -DDEBUG
+- STRIPCMD = /bin/true -Since_we_are_debugging
+-else
+- CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
+- STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
+-endif
++STRIPCMD = true
+
+
+ # the actual make rules
diff --git a/sys-power/cpupower/files/conf.d-r2 b/sys-power/cpupower/files/conf.d-r2
new file mode 100644
index 000000000000..1e67ed04e254
--- /dev/null
+++ b/sys-power/cpupower/files/conf.d-r2
@@ -0,0 +1,36 @@
+# /etc/conf.d/cpupower: config file for /etc/init.d/cpupower
+
+# Options when starting cpufreq (given to the `cpupower` program)
+# Possible options are:
+# -g --governor <GOV> (ie: ondemand, performance, or powersave)
+# -d --min <FREQ> (ie: 1000MHz)
+# -u --max <FREQ> (ie: 2000MHz)
+# -f --freq <FREQ> (requires userspace governor, this *can not* be combined with
+# with any other parameters).
+# Frequencies can be passed in Hz, kHz (default), MHz, GHz, or THz by postfixing the
+# value with the wanted unit name, without any space.
+# (frequency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).
+
+START_OPTS="--governor ondemand"
+
+# Options when stopping cpufreq (given to the `cpupower` program)
+# This option can be used to change governer on stop. Leaving it empty will ensure
+# the governer remains on the one provided above.
+STOP_OPTS=""
+
+# Extra settings to write to sysfs cpufreq values.
+#
+# up_threshold: threshold for stepping up frequency, where the value represents
+# the percentage of cpu load.
+#
+# down_threshold: threshold for stepping down frequency, where the value
+# represents the percentage of cpu load.
+#
+# sampling_down_factor: determines how frequently the governor polls the cpu, a
+# value greater than 1 improves performance by reducing the polling when the
+# load is high. This tunable has no effect on behavior at lower CPU frequencies.
+#
+# ignore_nice_load: when set to '1' the processes that are run with a 'nice'
+# value will not count in the usage calculation.
+
+#SYSFS_EXTRA="ondemand/ignore_nice_load=1 ondemand/up_threshold=75 ondemand/sampling_down_factor=10"
diff --git a/sys-power/cpupower/files/cpupower-frequency-set.service b/sys-power/cpupower/files/cpupower-frequency-set.service
new file mode 100644
index 000000000000..8f2f4d9b7628
--- /dev/null
+++ b/sys-power/cpupower/files/cpupower-frequency-set.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=CPU Frequency Scaling
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/cpupower frequency-set $OPTS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-power/cpupower/files/cpupower-frequency-set.service.conf b/sys-power/cpupower/files/cpupower-frequency-set.service.conf
new file mode 100644
index 000000000000..969c8ab2f214
--- /dev/null
+++ b/sys-power/cpupower/files/cpupower-frequency-set.service.conf
@@ -0,0 +1,2 @@
+[Service]
+Environment="OPTS=-g ondemand"
diff --git a/sys-power/cpupower/files/init.d-r4 b/sys-power/cpupower/files/init.d-r4
new file mode 100644
index 000000000000..febed865b250
--- /dev/null
+++ b/sys-power/cpupower/files/init.d-r4
@@ -0,0 +1,41 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+CPUFREQ_SYSFS=/sys/devices/system/cpu/cpufreq
+
+change() {
+ local c ret=0 opts="$1"
+ if [ -n "$opts" ] ; then
+ ebegin "Running cpupower -c all frequency-set ${opts}"
+ cpupower -c all frequency-set ${opts} >/dev/null 2>&1
+ : $(( ret += $? ))
+ eend ${ret}
+
+ if [ -d ${CPUFREQ_SYSFS} ] && [ -n "${SYSFS_EXTRA}" ] ; then
+ c=1
+ einfo "Setting extra options: ${SYSFS_EXTRA}"
+ if cd ${CPUFREQ_SYSFS} ; then
+ local o v
+ for o in ${SYSFS_EXTRA} ; do
+ v=${o#*=}
+ o=${o%%=*}
+ echo ${v} > ${o} || break
+ done
+ c=0
+ fi
+ eend ${c}
+ : $(( ret += c ))
+ fi
+ fi
+
+ return ${ret}
+}
+
+start() {
+ change "${START_OPTS}"
+}
+
+stop() {
+ change "${STOP_OPTS}"
+}