From 9051340d956b6d45bde3cf5811e423a1facdf17e Mon Sep 17 00:00:00 2001 From: honjow Date: Wed, 25 Oct 2023 02:48:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3gpu=E5=8D=A0=E7=94=A8?= =?UTF-8?q?=E7=8E=87=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config.py | 2 +- backend/gpu.py | 5 +++-- backend/sysInfo.py | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/config.py b/backend/config.py index 1f58b89..c73a13d 100755 --- a/backend/config.py +++ b/backend/config.py @@ -8,7 +8,7 @@ try: LOG_LOCATION = "/tmp/PowerControl_py.log" logging.basicConfig( - level = logging.DEBUG, + level = logging.INFO, filename = LOG_LOCATION, format="[%(asctime)s | %(filename)s:%(lineno)s:%(funcName)s] %(levelname)s: %(message)s", filemode = 'w', diff --git a/backend/gpu.py b/backend/gpu.py index f2de8f2..4f81c1e 100755 --- a/backend/gpu.py +++ b/backend/gpu.py @@ -155,7 +155,7 @@ def Check_gpuFreq(self, freqMin:int, freqMax:int): global gpu_freqMax global gpu_freqMin try: - logging.debug(f"GPUFREQ_PATH = {GPUFREQ_PATH}") + # logging.debug(f"GPUFREQ_PATH = {GPUFREQ_PATH}") #可查询gpu设置频率时,判断当前设置是否与系统相同 if os.path.exists(GPUFREQ_PATH): lines = open(GPUFREQ_PATH,"r") @@ -172,7 +172,8 @@ def Check_gpuFreq(self, freqMin:int, freqMax:int): command="sudo sh {} set_clock_limits {} {}".format(SH_PATH,freqMin,freqMax) os.system(command) else: - logging.debug(f"{self.name}|检测到当前设置与系统相同 当前系统频率 qfreqMin={qfreqMin} qfreMax={qfreqMax}") + # logging.debug(f"{self.name}|检测到当前设置与系统相同 当前系统频率 qfreqMin={qfreqMin} qfreMax={qfreqMax}") + pass #查不到gpu设置频率时,只要合法则进行设置 else: logging.debug(f"{self.name}|无法查询当前系统GPU频率") diff --git a/backend/sysInfo.py b/backend/sysInfo.py index 0259cd7..c94c393 100755 --- a/backend/sysInfo.py +++ b/backend/sysInfo.py @@ -6,7 +6,7 @@ import asyncio from ec import EC from config import logging,SH_PATH,PRODUCT_NAME -from config import FAN_GPUTEMP_PATH,FAN_CPUTEMP_PATH +from config import FAN_GPUTEMP_PATH,FAN_CPUTEMP_PATH,GPU_DEVICE_PATH from helpers import get_user cpu_busyPercent = 0 @@ -18,8 +18,9 @@ has_gpuData = True statPath="/proc/stat" -gpu_busy_percentPath="/sys/class/drm/card0/device/gpu_busy_percent" +gpu_busy_percentPath="{}/gpu_busy_percent".format(GPU_DEVICE_PATH) hwmon_path="/sys/class/hwmon" + #GPU单次监控数据 class GPUData: def __init__(self):