From fdd25e8dedb5be2ba34a72704ac545d1931aa7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Rodr=C3=ADguez?= Date: Sat, 29 Aug 2020 19:21:22 +0200 Subject: [PATCH 1/3] A fixed value of 25% CPU Load is not correct for enabling turbo, it should be enabled when one thread reach 100% --- source/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/core.py b/source/core.py index 3b3e322f..d99a0499 100644 --- a/source/core.py +++ b/source/core.py @@ -303,7 +303,7 @@ def set_powersave(): if load1m > CPUS / 7: print("High load, setting turbo boost: on") turbo(True) - elif cpuload > 25: + elif cpuload > 100 / CPUS: print("High CPU load, setting turbo boost: on") turbo(True) else: @@ -331,7 +331,7 @@ def mon_powersave(): print("Currently turbo boost is: off") footer() - elif cpuload > 25: + elif cpuload > 100 / CPUS: print("High CPU load, suggesting to set turbo boost: on") if turbo(): print("Currently turbo boost is: on") From 69ea85ab055b24dfda3ccc9e0787c25429a2d7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Rodr=C3=ADguez?= Date: Sat, 29 Aug 2020 19:43:22 +0200 Subject: [PATCH 2/3] A fixed turbo on chargin state --- source/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core.py b/source/core.py index d99a0499..22494264 100644 --- a/source/core.py +++ b/source/core.py @@ -364,7 +364,7 @@ def set_performance(): if load1m >= CPUS / 5: print("High load, setting turbo boost: on") turbo(True) - elif cpuload > 20: + elif cpuload > 100 / (CPUS * 2): print("High CPU load, setting turbo boost: on") turbo(True) else: From 290b2bbacf945fff9a1288cde3f42132098897a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Rodr=C3=ADguez?= Date: Mon, 31 Aug 2020 21:48:14 +0200 Subject: [PATCH 3/3] Improved 1 thread CPU 100% load detection solution --- source/core.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/core.py b/source/core.py index 22494264..5d181843 100644 --- a/source/core.py +++ b/source/core.py @@ -9,6 +9,7 @@ import sys import time import warnings +from math import isclose from pathlib import Path from pprint import pformat from subprocess import getoutput, call, run @@ -303,7 +304,7 @@ def set_powersave(): if load1m > CPUS / 7: print("High load, setting turbo boost: on") turbo(True) - elif cpuload > 100 / CPUS: + elif psutil.cpu_percent(percpu=False) >= 25.0 or isclose(max(psutil.cpu_percent(percpu=True)), 100): print("High CPU load, setting turbo boost: on") turbo(True) else: @@ -331,7 +332,7 @@ def mon_powersave(): print("Currently turbo boost is: off") footer() - elif cpuload > 100 / CPUS: + elif psutil.cpu_percent(percpu=False) >= 25.0 or isclose(max(psutil.cpu_percent(percpu=True)), 100): print("High CPU load, suggesting to set turbo boost: on") if turbo(): print("Currently turbo boost is: on") @@ -364,7 +365,7 @@ def set_performance(): if load1m >= CPUS / 5: print("High load, setting turbo boost: on") turbo(True) - elif cpuload > 100 / (CPUS * 2): + elif psutil.cpu_percent(percpu=False) >= 15.0 or isclose(max(psutil.cpu_percent(percpu=True)), 100): print("High CPU load, setting turbo boost: on") turbo(True) else: