Skip to content

Commit 3533c1f

Browse files
authored
prefer read than get info from kernel
1 parent 18c4371 commit 3533c1f

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

macOS/UXTU4Unix.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ def clear():
5555
| |_| |> < | | | |_| |_ _| |_| | ' \| \ \ /
5656
\___//_/\_\ |_| \___/ |_| \___/|_||_|_/_\_\ """)
5757
logging.info("")
58-
logging.info(
59-
f' {get_hardware_info("sysctl -n machdep.cpu.brand_string")}'
60-
)
58+
cpu = cfg.get('Info', 'CPU', fallback='')
59+
family = cfg.get('Info', 'Family', fallback='')
60+
if cpu and family:
61+
logging.info(f' {cpu} ({family})')
6162
if cfg.get('Settings', 'Debug', fallback='0') == '1':
6263
logging.info(f" Loaded: {cfg.get('User', 'Preset',fallback = '')}")
63-
logging.info(f" Version: {LOCAL_VERSION} by GorouFlex and AppleOSX (macOS Edition)")
64+
logging.info(f" Version: {LOCAL_VERSION} by AppleOSX (macOS Edition)")
6465
logging.info("")
6566

6667
def get_hardware_info(command, use_sudo=False):
@@ -203,7 +204,7 @@ def hardware_info():
203204
clear()
204205
logging.info("Processor Information:")
205206
logging.info(
206-
f' - Processor: {get_hardware_info("sysctl -n machdep.cpu.brand_string")}'
207+
f' - Processor: {cfg.get("Info", "CPU")}'
207208
)
208209
cpu_family = cfg.get('Info', 'Family')
209210
smu_version = get_hardware_info("Assets/ryzenadj -i | grep 'SMU BIOS Interface Version'", use_sudo=True).strip()
@@ -213,20 +214,17 @@ def hardware_info():
213214
logging.info(f' - {smu_version}')
214215
logging.info(f' - Architecture: {cfg.get("Info", "Architecture")}')
215216
logging.info(f' - Type: {cfg.get("Info", "Type")}')
216-
logging.info(f' - Cores: {get_hardware_info("sysctl -n hw.physicalcpu")}')
217-
logging.info(f' - Threads: {get_hardware_info("sysctl -n hw.logicalcpu")}')
217+
logging.info(f' - Cores: {cfg.get("Info", "Core Count")}')
218+
logging.info(f' - Threads: {cfg.get("Info", "Thread Count")}')
218219
logging.info(
219220
f""" - {get_hardware_info("system_profiler SPHardwareDataType | grep 'L2'")}"""
220221
)
221222
logging.info(
222223
f""" - {get_hardware_info("system_profiler SPHardwareDataType | grep 'L3'")}"""
223224
)
224-
base_clock = float(get_hardware_info("sysctl -n hw.cpufrequency_max")) / (10**9)
225-
logging.info(" - Base clock: {:.2f} GHz".format(base_clock))
225+
logging.info(f' - Max speed: {cfg.get("Info", "Max Speed")}')
226+
logging.info(f' - Current speed: {cfg.get("Info", "Current Speed")}')
226227
logging.info(f' - Vendor: {get_hardware_info("sysctl -n machdep.cpu.vendor")}')
227-
logging.info(
228-
f' - Instruction: {get_hardware_info("sysctl -a | grep machdep.cpu.features").split(": ")[1]}'
229-
)
230228
logging.info("")
231229
input("Press Enter to continue...")
232230

@@ -273,6 +271,12 @@ def welcome_tutorial():
273271
cfg.set('Settings', 'SIP', '03080000')
274272
cfg.set('Info', 'CPU', get_hardware_info(f"{current_dir}/Assets/dmidecode -t processor | grep 'Version' | awk -F': ' '{{print $2}}'", use_sudo=True).strip())
275273
cfg.set('Info', 'Signature', get_hardware_info(f"{current_dir}/Assets/dmidecode -t processor | grep 'Signature' | awk -F': ' '{{print $2}}'", use_sudo=True).strip())
274+
cfg.set('Info', 'Voltage', get_hardware_info(f"{current_dir}/Assets/dmidecode -t processor | grep 'Voltage' | awk -F': ' '{{print $2}}'", use_sudo=True).strip())
275+
cfg.set('Info', 'Max Speed', get_hardware_info(f"{current_dir}/Assets/dmidecode -t processor | grep 'Max Speed' | awk -F': ' '{{print $2}}'", use_sudo=True).strip())
276+
cfg.set('Info', 'Current Speed', get_hardware_info(f"{current_dir}/Assets/dmidecode -t processor | grep 'Current Speed' | awk -F': ' '{{print $2}}'", use_sudo=True).strip())
277+
cfg.set('Info', 'Core Count', get_hardware_info(f"{current_dir}/Assets/dmidecode -t processor | grep 'Core Count' | awk -F': ' '{{print $2}}'", use_sudo=True).strip())
278+
cfg.set('Info', 'Core Enabled', get_hardware_info(f"{current_dir}/Assets/dmidecode -t processor | grep 'Core Enabled' | awk -F': ' '{{print $2}}'", use_sudo=True).strip())
279+
cfg.set('Info', 'Thread Count', get_hardware_info(f"{current_dir}/Assets/dmidecode -t processor | grep 'Thread Count' | awk -F': ' '{{print $2}}'", use_sudo=True).strip())
276280
except ValueError:
277281
logging.info("Invalid option.")
278282
raise SystemExit

0 commit comments

Comments
 (0)