mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-16 09:06:23 +00:00
Update flask_server.py
This commit is contained in:
@@ -1598,8 +1598,8 @@ def get_detailed_gpu_info(gpu):
|
|||||||
try:
|
try:
|
||||||
# Try JSON output first (newer versions of intel_gpu_top)
|
# Try JSON output first (newer versions of intel_gpu_top)
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['intel_gpu_top', '-J', '-s', '100'],
|
['intel_gpu_top', '-J', '-s', '50'],
|
||||||
capture_output=True, text=True, timeout=2
|
capture_output=True, text=True, timeout=5
|
||||||
)
|
)
|
||||||
if result.returncode == 0 and result.stdout.strip():
|
if result.returncode == 0 and result.stdout.strip():
|
||||||
try:
|
try:
|
||||||
@@ -1614,14 +1614,15 @@ def get_detailed_gpu_info(gpu):
|
|||||||
detailed_info['engine_blitter'] = engines.get('Blitter', {}).get('busy', 0)
|
detailed_info['engine_blitter'] = engines.get('Blitter', {}).get('busy', 0)
|
||||||
detailed_info['engine_video'] = engines.get('Video', {}).get('busy', 0)
|
detailed_info['engine_video'] = engines.get('Video', {}).get('busy', 0)
|
||||||
detailed_info['engine_video_enhance'] = engines.get('VideoEnhance', {}).get('busy', 0)
|
detailed_info['engine_video_enhance'] = engines.get('VideoEnhance', {}).get('busy', 0)
|
||||||
except json.JSONDecodeError:
|
print(f"[v0] Intel GPU JSON parsed data: {detailed_info}")
|
||||||
pass
|
except json.JSONDecodeError as je:
|
||||||
|
print(f"[v0] JSON decode error for intel_gpu_top: {je}")
|
||||||
|
|
||||||
# Fallback to text parsing
|
# Fallback to text parsing
|
||||||
if not detailed_info or len(detailed_info) == 1: # Only has_monitoring_tool flag
|
if not detailed_info or len(detailed_info) == 1: # Only has_monitoring_tool flag
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['intel_gpu_top', '-s', '100'],
|
['intel_gpu_top', '-s', '50'],
|
||||||
capture_output=True, text=True, timeout=2
|
capture_output=True, text=True, timeout=5
|
||||||
)
|
)
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
output = result.stdout
|
output = result.stdout
|
||||||
@@ -1650,8 +1651,10 @@ def get_detailed_gpu_info(gpu):
|
|||||||
if match:
|
if match:
|
||||||
detailed_info[key] = float(match.group(1))
|
detailed_info[key] = float(match.group(1))
|
||||||
|
|
||||||
print(f"[v0] Intel GPU parsed data: {detailed_info}")
|
print(f"[v0] Intel GPU text parsed data: {detailed_info}")
|
||||||
|
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
print(f"[v0] intel_gpu_top timed out after 5 seconds")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[v0] Error getting Intel GPU details: {e}")
|
print(f"[v0] Error getting Intel GPU details: {e}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user