1
1
import subprocess
2
2
import os
3
3
import re
4
+ import traceback
4
5
from config import logging , SH_PATH , RYZENADJ_PATH
5
6
from config import (
6
7
TDP_LIMIT_CONFIG_CPU ,
7
8
TDP_LIMIT_CONFIG_PRODUCT ,
8
9
PRODUCT_NAME ,
9
10
CPU_ID ,
10
- PLATFORM_PROFILE_PATH ,
11
- PLATFORM_PROFILE_CHOICES_PATH ,
12
11
)
13
12
14
13
# 初始参数
@@ -50,6 +49,7 @@ def get_hasRyzenadj(self):
50
49
logging .info ("get_hasRyzenadj {}" .format (False ))
51
50
return False
52
51
except Exception as e :
52
+ logging .error (traceback .format_exc ())
53
53
logging .error (e )
54
54
return False
55
55
@@ -139,23 +139,24 @@ def set_cpuTDP(self, value: int):
139
139
140
140
command = f"{ sys_ryzenadj_path } -a { stapm_limit } -b { fast_minit } -c { slow_limit } -f { tctl_temp } "
141
141
command_args = command .split ()
142
- logging .info (f"set_cpuTDP command: { command } " )
143
- logging .info (f"set_cpuTDP { value } " )
142
+ logging .debug (f"set_cpuTDP command: { command } " )
143
+ logging .debug (f"set_cpuTDP { value } " )
144
144
process = subprocess .run (
145
145
command_args ,
146
146
stdout = subprocess .PIPE ,
147
147
stderr = subprocess .PIPE ,
148
148
text = True ,
149
149
)
150
150
stdout , stderr = process .stdout , process .stderr
151
- logging .info (f"set_cpuTDP result:\n { stdout } " )
151
+ logging .debug (f"set_cpuTDP result:\n { stdout } " )
152
152
if stderr :
153
153
logging .error (f"set_cpuTDP error:\n { stderr } " )
154
154
155
155
return True
156
156
else :
157
157
return False
158
158
except Exception as e :
159
+ logging .error (traceback .format_exc ())
159
160
logging .error (e )
160
161
return False
161
162
@@ -216,6 +217,7 @@ def set_cpuOnline(self, value: int):
216
217
self .online_cpu (int (cpu ))
217
218
return True
218
219
except Exception as e :
220
+ logging .error (traceback .format_exc ())
219
221
logging .error (e )
220
222
return False
221
223
@@ -258,6 +260,7 @@ def get_isSupportSMT(self):
258
260
else :
259
261
self .is_support_smt = int (stdout ) > 1
260
262
except Exception as e :
263
+ logging .error (traceback .format_exc ())
261
264
logging .error (e )
262
265
self .is_support_smt = False
263
266
return self .is_support_smt
@@ -272,6 +275,7 @@ def set_smt(self, value: bool):
272
275
cpu_smt = value
273
276
return True
274
277
except Exception as e :
278
+ logging .error (traceback .format_exc ())
275
279
logging .error (e )
276
280
return False
277
281
@@ -307,6 +311,7 @@ def set_cpuBoost(self, value: bool):
307
311
308
312
return True
309
313
except Exception as e :
314
+ logging .error (traceback .format_exc ())
310
315
logging .error (e )
311
316
return False
312
317
0 commit comments