Update flask_server.py

This commit is contained in:
MacRimi
2025-10-10 17:37:30 +02:00
parent 29893b89b3
commit de6f149e3b

View File

@@ -2200,8 +2200,8 @@ def get_detailed_gpu_info(gpu):
mem_total = int(detailed_info['memory_total'].replace(' MB', '')) mem_total = int(detailed_info['memory_total'].replace(' MB', ''))
if mem_total > 0: if mem_total > 0:
mem_util = (mem_used / mem_total) * 100 mem_util = (mem_used / mem_total) * 100
detailed_info['utilization_memory'] = f"{mem_util:.1f}%" detailed_info['utilization_memory'] = round(mem_util, 1)
print(f"[v0] Memory Utilization: {detailed_info['utilization_memory']}", flush=True) print(f"[v0] Memory Utilization: {detailed_info['utilization_memory']}%", flush=True)
# Parse GRBM (Graphics Register Bus Manager) for engine utilization # Parse GRBM (Graphics Register Bus Manager) for engine utilization
if 'GRBM' in device: if 'GRBM' in device:
@@ -2615,15 +2615,17 @@ def get_disk_hardware_info(disk_name):
try: try:
# Get disk type (HDD, SSD, NVMe) # Get disk type (HDD, SSD, NVMe)
result = subprocess.run(['lsblk', '-d', '-n', '-o', 'NAME,ROTA,TYPE', f'/dev/{disk_name}'], result = subprocess.run(['lsblk', '-d', '-n', '-o', 'NAME,ROTA,TYPE'],
capture_output=True, text=True, timeout=5) capture_output=True, text=True, timeout=5)
if result.returncode == 0: if result.returncode == 0:
parts = result.stdout.strip().split() for line in result.stdout.strip().split('\n'):
if len(parts) >= 2: parts = line.split()
if len(parts) >= 2 and parts[0] == disk_name:
rota = parts[1] rota = parts[1]
disk_info['type'] = 'HDD' if rota == '1' else 'SSD' disk_info['type'] = 'HDD' if rota == '1' else 'SSD'
if disk_name.startswith('nvme'): if disk_name.startswith('nvme'):
disk_info['type'] = 'NVMe SSD' disk_info['type'] = 'NVMe SSD'
break # Found the correct disk
# Get driver/kernel module # Get driver/kernel module
try: try: