import psutil
import platform
from sys import version as pyver
from pyrogram import __version__ as pyrover
def get_system_info():
p_core = psutil.cpu_count(logical=False) # Physical cores
t_core = psutil.cpu_count(logical=True) # Logical cores
ram = str(round(psutil.virtual_memory().total / (1024.0**3))) + " GB"
try:
cpu_freq = psutil.cpu_freq().current
if cpu_freq >= 1000:
cpu_freq = f"{round(cpu_freq / 1000, 2)} ɢʜᴢ"
else:
cpu_freq = f"{round(cpu_freq, 2)} ᴍʜᴢ"
except Exception:
cpu_freq = "ғᴀɪʟᴇᴅ ᴛᴏ ғᴇᴛᴄʜ"
# HDD information
hdd = psutil.disk_usage("/")
total_hdd = round(hdd.total / (1024.0**3), 2) # Total space in GB
used_hdd = round(hdd.used / (1024.0**3), 2) # Used space in GB
free_hdd = round(hdd.free / (1024.0**3), 2) # Free space in GB
# Return system information as a dictionary
return {
"Physical Cores": p_core,
"Logical Cores": t_core,
"RAM": ram,
"CPU Frequency": cpu_freq,
"HDD Total": f"{total_hdd} GB",
"HDD Used": f"{used_hdd} GB",
"HDD Free": f"{free_hdd} GB",
"Python Version": pyver.split()[0] if pyver else "Unknown",
"Pyrogram Version": pyrover
}
if __name__ == "__main__":
system_info = get_system_info()
text=""
for key, value in system_info.items():
text+=f"{key}: {value}\n"
print(text)
Jᴏɪɴ ᴜs :- @Python_Codes_Pro
Support group :- @python_group_pro