mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-07-27 07:34:25 +02:00
Merge branch 'master' into shadeyg56-dev
This commit is contained in:
commit
75cfa71ff4
21
README.md
21
README.md
@ -351,6 +351,27 @@ Once you have made the necessary changes to the GRUB configuration file, you can
|
|||||||
# Legacy boot method for grub update.
|
# Legacy boot method for grub update.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For systemd-boot users:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo nano /etc/kernel/cmdline
|
||||||
|
# make sure you have nano installed, or you can use your favorite text editor.
|
||||||
|
```
|
||||||
|
|
||||||
|
For Intel users:
|
||||||
|
|
||||||
|
```
|
||||||
|
quiet splash intel_pstate=disable
|
||||||
|
```
|
||||||
|
|
||||||
|
For AMD users:
|
||||||
|
|
||||||
|
```
|
||||||
|
quiet splash initcall_blacklist=amd_pstate_init amd_pstate.enable=0
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you have made the necessary changes to the cmdline file, you can update it by running `sudo reinstall-kernels`.
|
||||||
|
|
||||||
### AUR
|
### AUR
|
||||||
|
|
||||||
* The command ```sudo auto-cpufreq --install``` produces error [#471](https://github.com/AdnanHodzic/auto-cpufreq/issues/471) please don't use it.
|
* The command ```sudo auto-cpufreq --install``` produces error [#471](https://github.com/AdnanHodzic/auto-cpufreq/issues/471) please don't use it.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# auto-cpufreq-installer:
|
# auto-cpufreq-installer:
|
||||||
# auto-cpufreq source code based installer
|
# auto-cpufreq source code based installer
|
||||||
@ -111,10 +111,10 @@ function manual_install {
|
|||||||
Didn't detect Debian or RedHat based distro.
|
Didn't detect Debian or RedHat based distro.
|
||||||
|
|
||||||
To complete installation, you need to:
|
To complete installation, you need to:
|
||||||
Install: python3, pip3, python3-setuptools
|
Install: python3, pip3, python3-setuptools, gobject-introspection, cairo (or cairo-devel), gcc, and gtk3
|
||||||
|
|
||||||
Install necessary Python packages:
|
Install necessary Python packages:
|
||||||
pip3 install psutil click distro power
|
pip3 install psutil click distro power requests PyGObject
|
||||||
Run following sequence of lines:
|
Run following sequence of lines:
|
||||||
|
|
||||||
-----
|
-----
|
||||||
@ -148,21 +148,21 @@ function tool_install {
|
|||||||
separator
|
separator
|
||||||
if [ -f /etc/debian_version ]; then
|
if [ -f /etc/debian_version ]; then
|
||||||
detected_distro "Debian based"
|
detected_distro "Debian based"
|
||||||
apt install python3-dev python3-pip python3-venv python3-setuptools dmidecode libgirepository1.0-dev libcairo2-dev -y
|
apt install python3-dev python3-pip python3-venv python3-setuptools dmidecode libgirepository1.0-dev libcairo2-dev libgtk-3 gcc -y
|
||||||
completed
|
completed
|
||||||
complete_msg
|
complete_msg
|
||||||
elif [ -f /etc/redhat-release ]; then
|
elif [ -f /etc/redhat-release ]; then
|
||||||
detected_distro "RedHat based"
|
detected_distro "RedHat based"
|
||||||
if [ -f /etc/centos-release ]; then
|
if [ -f /etc/centos-release ]; then
|
||||||
yum install platform-python-devel dmidecode
|
yum install platform-python-devel dmidecode gcc cairo-devel gobject-introspection-devel cairo-gobject-devel gtk3-devel
|
||||||
else
|
else
|
||||||
yum install python-devel dmidecode
|
yum install python-devel dmidecode gcc cairo-devel gobject-introspection-devel cairo-gobject-devel gtk3-devel
|
||||||
fi
|
fi
|
||||||
completed
|
completed
|
||||||
complete_msg
|
complete_msg
|
||||||
elif [ -f /etc/solus-release ]; then
|
elif [ -f /etc/solus-release ]; then
|
||||||
detected_distro "Solus"
|
detected_distro "Solus"
|
||||||
eopkg install pip python3 python3-devel dmidecode
|
eopkg install pip python3 python3-devel dmidecode gobject-introspection-devel libcairo-devel gcc libgtk-3
|
||||||
eopkg install -c system.devel
|
eopkg install -c system.devel
|
||||||
completed
|
completed
|
||||||
complete_msg
|
complete_msg
|
||||||
@ -172,23 +172,23 @@ elif [ -f /etc/os-release ];then
|
|||||||
case $ID in
|
case $ID in
|
||||||
opensuse-leap)
|
opensuse-leap)
|
||||||
detected_distro "OpenSUSE"
|
detected_distro "OpenSUSE"
|
||||||
zypper install -y python3 python3-pip python3-setuptools python3-devel gcc dmidecode
|
zypper install -y python3 python3-pip python3-setuptools python3-devel gcc dmidecode gobject-introspection-devel python3-cairo-devel gtk3 gtk3-devel
|
||||||
completed
|
completed
|
||||||
;;
|
;;
|
||||||
opensuse)
|
opensuse-tumbleweed)
|
||||||
detected_distro "OpenSUSE"
|
detected_distro "OpenSUSE"
|
||||||
echo -e "\nDetected an OpenSUSE distribution\n\nSetting up Python environment\n"
|
echo -e "\nDetected an OpenSUSE distribution\n\nSetting up Python environment\n"
|
||||||
zypper install -y python38 python3-pip python3-setuptools python3-devel gcc dmidecode gobject-introspection-devel python3-cairo-devel
|
zypper install -y python38 python3-pip python3-setuptools python3-devel gcc dmidecode gobject-introspection-devel python3-cairo-devel gtk3 gtk3-devel
|
||||||
completed
|
completed
|
||||||
;;
|
;;
|
||||||
arch|manjaro|endeavouros|garuda|artix)
|
arch|manjaro|endeavouros|garuda|artix)
|
||||||
detected_distro "Arch Linux based"
|
detected_distro "Arch Linux based"
|
||||||
pacman -S --noconfirm --needed python python-pip python-setuptools base-devel dmidecode gobject-introspection
|
pacman -S --noconfirm --needed python python-pip python-setuptools base-devel dmidecode gobject-introspection gtk3 gcc
|
||||||
completed
|
completed
|
||||||
;;
|
;;
|
||||||
void)
|
void)
|
||||||
detected_distro "Void Linux"
|
detected_distro "Void Linux"
|
||||||
xbps-install -Sy python3 python3-pip python3-devel python3-setuptools base-devel dmidecode
|
xbps-install -Sy python3 python3-pip python3-devel python3-setuptools base-devel dmidecode cairo-devel gobject-introspection gcc gtk+3
|
||||||
completed
|
completed
|
||||||
;;
|
;;
|
||||||
*) #Any other distro
|
*) #Any other distro
|
||||||
|
@ -1194,31 +1194,34 @@ def sysinfo():
|
|||||||
offline_cpus = [str(cpu) for cpu in range(total_cpu_count) if cpu not in cpu_core]
|
offline_cpus = [str(cpu) for cpu in range(total_cpu_count) if cpu not in cpu_core]
|
||||||
|
|
||||||
# temperatures
|
# temperatures
|
||||||
core_temp = psutil.sensors_temperatures()
|
temp_sensors = psutil.sensors_temperatures()
|
||||||
temp_per_cpu = [float("nan")] * online_cpu_count
|
temp_per_cpu = [float("nan")] * online_cpu_count
|
||||||
try:
|
try:
|
||||||
if "coretemp" in core_temp:
|
# the priority for CPU temp is as follows: coretemp sensor -> sensor with CPU in the label -> acpi -> k10temp
|
||||||
|
if "coretemp" in temp_sensors:
|
||||||
# list labels in 'coretemp'
|
# list labels in 'coretemp'
|
||||||
core_temp_labels = [temp.label for temp in core_temp["coretemp"]]
|
core_temp_labels = [temp.label for temp in temp_sensors["coretemp"]]
|
||||||
for i, cpu in enumerate(cpu_core):
|
for i, cpu in enumerate(cpu_core):
|
||||||
# get correct index in core_temp
|
# get correct index in temp_sensors
|
||||||
core = cpu_core[cpu]
|
core = cpu_core[cpu]
|
||||||
cpu_temp_index = core_temp_labels.index(f"Core {core}")
|
cpu_temp_index = core_temp_labels.index(f"Core {core}")
|
||||||
temp_per_cpu[i] = core_temp["coretemp"][cpu_temp_index].current
|
temp_per_cpu[i] = temp_sensors["coretemp"][cpu_temp_index].current
|
||||||
else:
|
else:
|
||||||
# iterate over all sensors
|
# iterate over all sensors
|
||||||
for sensor in core_temp:
|
for sensor in temp_sensors:
|
||||||
# iterate over all temperatures in the current sensor
|
# iterate over all temperatures in the current sensor
|
||||||
for temp in core_temp[sensor]:
|
for temp in temp_sensors[sensor]:
|
||||||
if temp.label == 'CPU':
|
if 'CPU' in temp.label:
|
||||||
temp_per_cpu = [temp.current] * online_cpu_count
|
temp_per_cpu = [temp.current] * online_cpu_count
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
else: # if 'CPU' label not found in any sensor, use first available temperature
|
else:
|
||||||
temp = list(core_temp.keys())[0]
|
if "acpitz" in temp_sensors:
|
||||||
temp_per_cpu = [core_temp[temp][0].current] * online_cpu_count
|
temp_per_cpu = [temp_sensors["acpitz"][0].current] * online_cpu_count
|
||||||
|
elif "k10temp" in temp_sensors:
|
||||||
|
temp_per_cpu = [temp_sensors["k10temp"][0].current] * online_cpu_count
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(repr(e))
|
print(repr(e))
|
||||||
pass
|
pass
|
||||||
|
@ -232,7 +232,7 @@ def main(config, daemon, debug, update, install, remove, live, log, monitor, sta
|
|||||||
|
|
||||||
print("Please update using snap package manager, i.e: `sudo snap refresh auto-cpufreq`.")
|
print("Please update using snap package manager, i.e: `sudo snap refresh auto-cpufreq`.")
|
||||||
#check for AUR
|
#check for AUR
|
||||||
elif subprocess.run(["bash", "-c", "command -v yay >/dev/null 2>&1"]).returncode == 0 or subprocess.run(["bash", "-c", "command -v pacman >/dev/null 2>&1"]).returncode == 0:
|
elif subprocess.run(["bash", "-c", "command -v pacman >/dev/null 2>&1"]).returncode == 0 and subprocess.run(["bash", "-c", "pacman -Q auto-cpufreq >/dev/null 2>&1"]).returncode == 0:
|
||||||
print("Arch-based distribution with AUR support detected. Please refresh auto-cpufreq using your AUR helper.")
|
print("Arch-based distribution with AUR support detected. Please refresh auto-cpufreq using your AUR helper.")
|
||||||
else:
|
else:
|
||||||
verify_update()
|
verify_update()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# auto-cpufreq daemon install script
|
# auto-cpufreq daemon install script
|
||||||
# reference: https://github.com/AdnanHodzic/auto-cpufreq
|
# reference: https://github.com/AdnanHodzic/auto-cpufreq
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# workaround for running Daemon without polluting syslog (#53, #82)
|
# workaround for running Daemon without polluting syslog (#53, #82)
|
||||||
$SNAP/bin/auto-cpufreq --daemon 2>&1 >> $SNAP_DATA/auto-cpufreq.stats
|
$SNAP/bin/auto-cpufreq --daemon 2>&1 >> $SNAP_DATA/auto-cpufreq.stats
|
||||||
|
@ -24,6 +24,8 @@ parts:
|
|||||||
build-packages:
|
build-packages:
|
||||||
- gcc
|
- gcc
|
||||||
- python3-dev
|
- python3-dev
|
||||||
|
- libgirepository1.0-dev
|
||||||
|
- libcairo2-dev
|
||||||
stage-packages:
|
stage-packages:
|
||||||
- coreutils
|
- coreutils
|
||||||
- dmidecode
|
- dmidecode
|
||||||
@ -62,24 +64,18 @@ apps:
|
|||||||
- system-observe
|
- system-observe
|
||||||
- hardware-observe
|
- hardware-observe
|
||||||
- etc-auto-cpufreq-conf
|
- etc-auto-cpufreq-conf
|
||||||
|
|
||||||
auto-cpufreq-gtk:
|
auto-cpufreq-gtk:
|
||||||
command: bin/auto-cpufreq-gtk
|
command: bin/auto-cpufreq-gtk
|
||||||
extensions: [gnome]
|
|
||||||
environment:
|
environment:
|
||||||
PYTHONPATH: $SNAP/usr/lib/python3/site-packages:$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
|
PYTHONPATH: $SNAP/usr/lib/python3/site-packages:$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
|
||||||
LC_ALL: C.UTF-8
|
LC_ALL: C.UTF-8
|
||||||
LANG: C.UTF-8
|
LANG: C.UTF-8
|
||||||
PKG_MARKER: SNAP
|
PKG_MARKER: SNAP
|
||||||
plugs:
|
plugs:
|
||||||
- desktop
|
|
||||||
- desktop-legacy
|
|
||||||
- wayland
|
|
||||||
- x11
|
|
||||||
- cpu-control
|
- cpu-control
|
||||||
- system-observe
|
- system-observe
|
||||||
- hardware-observe
|
- hardware-observe
|
||||||
|
- etc-auto-cpufreq-conf
|
||||||
service:
|
service:
|
||||||
command: usr/bin/snapdaemon
|
command: usr/bin/snapdaemon
|
||||||
plugs:
|
plugs:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user