Skip to content

Commit

Permalink
more error log
Browse files Browse the repository at this point in the history
  • Loading branch information
honjow committed Apr 26, 2024
1 parent 009b750 commit f9fa8c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def load_yaml(file_path: str, chk_schema=None) -> dict:

product_version = PRODUCT_VERSION if PRODUCT_VERSION != "Default string" else ""
key = f"{PRODUCT_NAME}{product_version}"
logging.info(f"风扇配置key: {key}")
logging.info(f"fans config key: {key}")
FAN_EC_CONFIG = FAN_EC_CONFIG_MAP.get(key, [])
logging.info(f"FAN_EC_CONFIG: {FAN_EC_CONFIG}")

Expand Down
15 changes: 10 additions & 5 deletions backend/cpu.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import subprocess
import os
import re
import traceback
from config import logging, SH_PATH, RYZENADJ_PATH
from config import (
TDP_LIMIT_CONFIG_CPU,
TDP_LIMIT_CONFIG_PRODUCT,
PRODUCT_NAME,
CPU_ID,
PLATFORM_PROFILE_PATH,
PLATFORM_PROFILE_CHOICES_PATH,
)

# 初始参数
Expand Down Expand Up @@ -50,6 +49,7 @@ def get_hasRyzenadj(self):
logging.info("get_hasRyzenadj {}".format(False))
return False
except Exception as e:
logging.error(traceback.format_exc())
logging.error(e)
return False

Expand Down Expand Up @@ -139,23 +139,24 @@ def set_cpuTDP(self, value: int):

command = f"{sys_ryzenadj_path} -a {stapm_limit} -b {fast_minit} -c {slow_limit} -f {tctl_temp}"
command_args = command.split()
logging.info(f"set_cpuTDP command: {command}")
logging.info(f"set_cpuTDP {value}")
logging.debug(f"set_cpuTDP command: {command}")
logging.debug(f"set_cpuTDP {value}")
process = subprocess.run(
command_args,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)
stdout, stderr = process.stdout, process.stderr
logging.info(f"set_cpuTDP result:\n{stdout}")
logging.debug(f"set_cpuTDP result:\n{stdout}")
if stderr:
logging.error(f"set_cpuTDP error:\n{stderr}")

return True
else:
return False
except Exception as e:
logging.error(traceback.format_exc())
logging.error(e)
return False

Expand Down Expand Up @@ -216,6 +217,7 @@ def set_cpuOnline(self, value: int):
self.online_cpu(int(cpu))
return True
except Exception as e:
logging.error(traceback.format_exc())
logging.error(e)
return False

Expand Down Expand Up @@ -258,6 +260,7 @@ def get_isSupportSMT(self):
else:
self.is_support_smt = int(stdout) > 1
except Exception as e:
logging.error(traceback.format_exc())
logging.error(e)
self.is_support_smt = False
return self.is_support_smt
Expand All @@ -272,6 +275,7 @@ def set_smt(self, value: bool):
cpu_smt = value
return True
except Exception as e:
logging.error(traceback.format_exc())
logging.error(e)
return False

Expand Down Expand Up @@ -307,6 +311,7 @@ def set_cpuBoost(self, value: bool):

return True
except Exception as e:
logging.error(traceback.format_exc())
logging.error(e)
return False

Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import traceback
import decky_plugin
from settings import SettingsManager

Expand All @@ -17,7 +18,6 @@

except Exception as e:
# 堆栈跟踪
import traceback
logging.error(traceback.format_exc())
logging.error(e)

Expand Down

0 comments on commit f9fa8c5

Please sign in to comment.