summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorQue Quotion2022-02-20 03:31:27 +0900
committerQue Quotion2022-02-20 03:31:27 +0900
commit9b2e7d0738e6805387f5d7dafc4b903de4d1a085 (patch)
tree8f8bb07b146e4ecdf4e9f55419b4e4a116030e77
parentc1bebebf72ddd6787388dc7652a0d7f98f233eef (diff)
downloadaur-9b2e7d0738e6805387f5d7dafc4b903de4d1a085.tar.gz
a new and better way to set hyperthreads
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD8
-rw-r--r--performance2
-rw-r--r--powersave2
-rwxr-xr-xthrottlectl21
5 files changed, 19 insertions, 22 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 893cd99166ca..32b874b540ee 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = throttlectl
pkgdesc = Command-line user discretion power managment utility
- pkgver = 3
+ pkgver = 4
pkgrel = 1
url = https://bbs.archlinux.org/viewtopic.php?id=180762
arch = any
@@ -17,9 +17,9 @@ pkgbase = throttlectl
source = throttle-cut.service
source = powersave
source = performance
- sha512sums = 3c447a074a1b631d869b2fb61fe0a718cce3a82f872d147a58d7fb5eace13611e68799087e9a386fe2860fbab794f36ac787e003ec8ede27aad472840b7158d4
+ sha512sums = a116c2c66099086eb8d8f42bdb1f8db7c093ca824d510f13a91ee406d13da55264f810a119590f44e774430e2bd9aba81d03ab531d147e227a1db0f71459c8ce
sha512sums = 6254e73446a91ea7945b9e4db1a1047eb2055d93aee315006857711ab21cba140da3badcf5834d2628e4799494a069647d11aa378a9bac67691df8d8b3adc12f
- sha512sums = 3d487961bf86254817fd099b888d6245bbf1e57622166dc8df378d639bfb1c0fc105646038be6093183be102294394b88cde382fe961f7606b68619af4a00595
- sha512sums = d11ed5f4344f07507497e816ccd7612ffc6df70636ca5f4817a9ce6e3b190b3a17fb02c44c4bf648359f640e4c63cc0b0134968ff4d3d989ad05fa4c095b03d3
+ sha512sums = 926f7c787aea8c1027f331fe2e9417ba8e4f15a79f51610baafeed5d0de86d8f41da92f4460c29a5ce251e7cc110e26c2c344931af91949dc529595cc18c0f0e
+ sha512sums = 0d90ae4c0b9600f50ffd3e2c1a03b49d2fbdb9a2d14c8211e86463787549ada156498f68989d851952fe34660daaacc11242f5ee9e9e318f3d2a3eba0971eb53
pkgname = throttlectl
diff --git a/PKGBUILD b/PKGBUILD
index f31e87afeb63..3d34730e1876 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Que Quotion <quequotion@mailinator.com>
pkgname=throttlectl
-pkgver=3
+pkgver=4
pkgrel=1
pkgdesc="Command-line user discretion power managment utility"
arch=('any')
@@ -14,10 +14,10 @@ source=('throttlectl'
'throttle-cut.service'
'powersave'
'performance')
-sha512sums=('3c447a074a1b631d869b2fb61fe0a718cce3a82f872d147a58d7fb5eace13611e68799087e9a386fe2860fbab794f36ac787e003ec8ede27aad472840b7158d4'
+sha512sums=('a116c2c66099086eb8d8f42bdb1f8db7c093ca824d510f13a91ee406d13da55264f810a119590f44e774430e2bd9aba81d03ab531d147e227a1db0f71459c8ce'
'6254e73446a91ea7945b9e4db1a1047eb2055d93aee315006857711ab21cba140da3badcf5834d2628e4799494a069647d11aa378a9bac67691df8d8b3adc12f'
- '3d487961bf86254817fd099b888d6245bbf1e57622166dc8df378d639bfb1c0fc105646038be6093183be102294394b88cde382fe961f7606b68619af4a00595'
- 'd11ed5f4344f07507497e816ccd7612ffc6df70636ca5f4817a9ce6e3b190b3a17fb02c44c4bf648359f640e4c63cc0b0134968ff4d3d989ad05fa4c095b03d3')
+ '926f7c787aea8c1027f331fe2e9417ba8e4f15a79f51610baafeed5d0de86d8f41da92f4460c29a5ce251e7cc110e26c2c344931af91949dc529595cc18c0f0e'
+ '0d90ae4c0b9600f50ffd3e2c1a03b49d2fbdb9a2d14c8211e86463787549ada156498f68989d851952fe34660daaacc11242f5ee9e9e318f3d2a3eba0971eb53')
package() {
install -Dm755 {${srcdir},${pkgdir}/usr/bin}/throttlectl
diff --git a/performance b/performance
index a99aad22f750..697720d35200 100644
--- a/performance
+++ b/performance
@@ -1,4 +1,4 @@
-HYPERTHREADS="1"
+HYPERTHREADS="on"
GOVERNOR="performance"
XPSTURBO="0"
ENERGYPERF="0"
diff --git a/powersave b/powersave
index 10a08db2c7d5..5b46fada2005 100644
--- a/powersave
+++ b/powersave
@@ -1,4 +1,4 @@
-HYPERTHREADS="0"
+HYPERTHREADS="off"
GOVERNOR="powersave"
XPSTURBO="1"
ENERGYPERF="15"
diff --git a/throttlectl b/throttlectl
index a86c96824b8f..3aa8461e197b 100755
--- a/throttlectl
+++ b/throttlectl
@@ -29,17 +29,14 @@ config_help() {
}
throttle_ht() {
- for i in /sys/devices/system/cpu/cpu*/online; do \
- [[ "$(printf "${i}" | tr -cd [:digit:])" -ge "${CORES}" ]] && \
- printf "${HYPERTHREADS}" > "${i}" ; done &
- [[ "${HYPERTHREADS}" == "1" ]] && wait
+ [[ -f /sys/devices/system/cpu/smt/control ]] && \
+ printf "${HYPERTHREADS}" > /sys/devices/system/cpu/smt/control &
}
check_ht() {
- printf "\nHyperthreads\n/sys/devices/system/cpu/cpu*/online\n"
- for i in /sys/devices/system/cpu/cpu*/online; do \
- [[ $(printf "${i}" | tr -cd [:digit:]) -ge "$CORES" ]] && \
- printf " ${i}\n$(cat ${i})\n"; done | sed 's|/sys/devices/system/cpu/||g; s|/.*||g; N;s|\n|\t|'
+ [[ -f /sys/devices/system/cpu/smt/control ]] && \
+ echo -e "\nHyperthreads\n/sys/devices/system/cpu/smt/\n"\
+ "control\t$(cat /sys/devices/system/cpu/smt/control)"
}
throttle_gov() {
@@ -216,12 +213,12 @@ while (( "$#" )); do
case "$1" in
ht*)
case "${1}" in \
- ht-on) HYPERTHREADS="1" ;; \
- ht-off) HYPERTHREADS="0" ;; esac
+ ht-on) HYPERTHREADS="on" ;; \
+ ht-off) HYPERTHREADS="off" ;; esac
[[ -z "${HYPERTHREADS}" ]] && \
case "${2}" in \
- cut|off|powersave|start) HYPERTHREADS="0"; SHIFT="2" ;; \
- full|on|performance|stop) HYPERTHREADS="1"; SHIFT="2" ;; \
+ cut|off|powersave|start) HYPERTHREADS="off"; SHIFT="2" ;; \
+ full|on|performance|stop) HYPERTHREADS="on"; SHIFT="2" ;; \
check|status) check_ht; SHIFT="2" ;; esac
[[ -n "${HYPERTHREADS}" ]] && throttle_ht
[[ -n "${SHIFT}" ]] && shift "${SHIFT}" || shift