mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-16 09:06:23 +00:00
Update AppImage
This commit is contained in:
@@ -64,19 +64,11 @@ export default function Hardware() {
|
|||||||
const [selectedDisk, setSelectedDisk] = useState<StorageDevice | null>(null)
|
const [selectedDisk, setSelectedDisk] = useState<StorageDevice | null>(null)
|
||||||
const [selectedNetwork, setSelectedNetwork] = useState<PCIDevice | null>(null)
|
const [selectedNetwork, setSelectedNetwork] = useState<PCIDevice | null>(null)
|
||||||
|
|
||||||
const realtimeURL = selectedGPU ? `/api/gpu/${selectedGPU.slot}/realtime` : null
|
const { data: realtimeGPUData } = useSWR<any>(selectedGPU ? `/api/gpu/${selectedGPU.slot}/realtime` : null, fetcher, {
|
||||||
console.log("[v0] GPU modal opened, selectedGPU:", selectedGPU)
|
refreshInterval: 2000, // Update every 2 seconds
|
||||||
console.log("[v0] Realtime URL:", realtimeURL)
|
|
||||||
|
|
||||||
const { data: realtimeGPUData, error: realtimeError } = useSWR<any>(realtimeURL, fetcher, {
|
|
||||||
refreshInterval: 2000,
|
|
||||||
revalidateOnFocus: false,
|
revalidateOnFocus: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log("[v0] Realtime GPU data:", realtimeGPUData)
|
|
||||||
console.log("[v0] Realtime GPU error:", realtimeError)
|
|
||||||
// </CHANGE>
|
|
||||||
|
|
||||||
const findPCIDeviceForGPU = (gpu: GPU): PCIDevice | null => {
|
const findPCIDeviceForGPU = (gpu: GPU): PCIDevice | null => {
|
||||||
if (!hardwareData?.pci_devices || !gpu.slot) return null
|
if (!hardwareData?.pci_devices || !gpu.slot) return null
|
||||||
|
|
||||||
@@ -103,7 +95,9 @@ export default function Hardware() {
|
|||||||
(combinedData.temperature !== undefined && combinedData.temperature > 0) ||
|
(combinedData.temperature !== undefined && combinedData.temperature > 0) ||
|
||||||
combinedData.utilization_gpu !== undefined ||
|
combinedData.utilization_gpu !== undefined ||
|
||||||
combinedData.memory_total ||
|
combinedData.memory_total ||
|
||||||
combinedData.power_draw
|
combinedData.power_draw ||
|
||||||
|
combinedData.engine_render !== undefined ||
|
||||||
|
combinedData.clock_graphics
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,20 +404,219 @@ export default function Hardware() {
|
|||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* GPU Detail Modal */}
|
{/* GPU Detail Modal - Two different modals based on data availability */}
|
||||||
<Dialog open={selectedGPU !== null} onOpenChange={() => setSelectedGPU(null)}>
|
<Dialog open={selectedGPU !== null} onOpenChange={() => setSelectedGPU(null)}>
|
||||||
<DialogContent className="max-w-2xl max-h-[80vh] overflow-y-auto">
|
<DialogContent className="max-w-2xl max-h-[80vh] overflow-y-auto">
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>{selectedGPU?.name}</DialogTitle>
|
|
||||||
<DialogDescription>PCI Device Information</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
{selectedGPU &&
|
{selectedGPU &&
|
||||||
(() => {
|
(() => {
|
||||||
const pciDevice = findPCIDeviceForGPU(selectedGPU)
|
const pciDevice = findPCIDeviceForGPU(selectedGPU)
|
||||||
const combinedGPU = { ...selectedGPU, ...realtimeGPUData }
|
const combinedGPU = { ...selectedGPU, ...realtimeGPUData }
|
||||||
|
const hasRealtime = hasRealtimeData(selectedGPU, realtimeGPUData)
|
||||||
|
|
||||||
|
if (hasRealtime) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>{selectedGPU.name}</DialogTitle>
|
||||||
|
<DialogDescription>Real-Time GPU Monitoring</DialogDescription>
|
||||||
|
</DialogHeader>
|
||||||
|
|
||||||
|
<div className="space-y-4">
|
||||||
|
{/* Basic Information */}
|
||||||
|
<div className="space-y-2">
|
||||||
|
<h3 className="font-semibold text-sm">Basic Information</h3>
|
||||||
|
<div className="grid gap-2">
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Vendor</span>
|
||||||
|
<Badge className={getDeviceTypeColor("graphics")}>{selectedGPU.vendor}</Badge>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Type</span>
|
||||||
|
<span className="text-sm font-medium">{selectedGPU.type}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">PCI Slot</span>
|
||||||
|
<span className="font-mono text-sm">{pciDevice?.slot || selectedGPU.slot}</span>
|
||||||
|
</div>
|
||||||
|
{(pciDevice?.driver || selectedGPU.pci_driver) && (
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Driver</span>
|
||||||
|
<span className="font-mono text-sm text-green-500">
|
||||||
|
{pciDevice?.driver || selectedGPU.pci_driver}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{(pciDevice?.kernel_module || selectedGPU.pci_kernel_module) && (
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Kernel Module</span>
|
||||||
|
<span className="font-mono text-sm">
|
||||||
|
{pciDevice?.kernel_module || selectedGPU.pci_kernel_module}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Real-Time Metrics */}
|
||||||
|
<div className="space-y-2">
|
||||||
|
<h3 className="font-semibold text-sm">Real-Time Metrics</h3>
|
||||||
|
<div className="grid gap-2">
|
||||||
|
{combinedGPU.temperature !== undefined && combinedGPU.temperature > 0 && (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="text-sm text-muted-foreground">Temperature</span>
|
||||||
|
<span className="text-sm font-semibold text-green-500">
|
||||||
|
{combinedGPU.temperature}°C
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<Progress value={(combinedGPU.temperature / 100) * 100} className="h-2" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{combinedGPU.utilization_gpu !== undefined && (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="text-sm text-muted-foreground">GPU Utilization</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.utilization_gpu}%</span>
|
||||||
|
</div>
|
||||||
|
<Progress value={combinedGPU.utilization_gpu} className="h-2" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{combinedGPU.clock_graphics && (
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Graphics Clock</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.clock_graphics}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{combinedGPU.clock_memory && (
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Memory Clock</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.clock_memory}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{combinedGPU.power_draw && combinedGPU.power_draw !== "N/A" && (
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Power Draw</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.power_draw}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{combinedGPU.power_limit && (
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Power Limit</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.power_limit}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Engine Utilization (Intel/AMD) */}
|
||||||
|
{(combinedGPU.engine_render !== undefined ||
|
||||||
|
combinedGPU.engine_blitter !== undefined ||
|
||||||
|
combinedGPU.engine_video !== undefined ||
|
||||||
|
combinedGPU.engine_video_enhance !== undefined) && (
|
||||||
|
<div className="space-y-2">
|
||||||
|
<h3 className="font-semibold text-sm">Engine Utilization</h3>
|
||||||
|
<div className="grid gap-2">
|
||||||
|
{combinedGPU.engine_render !== undefined && (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="text-sm text-muted-foreground">Render/3D</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.engine_render.toFixed(2)}%</span>
|
||||||
|
</div>
|
||||||
|
<Progress value={combinedGPU.engine_render} className="h-2" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{combinedGPU.engine_blitter !== undefined && (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="text-sm text-muted-foreground">Blitter</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.engine_blitter.toFixed(2)}%</span>
|
||||||
|
</div>
|
||||||
|
<Progress value={combinedGPU.engine_blitter} className="h-2" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{combinedGPU.engine_video !== undefined && (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="text-sm text-muted-foreground">Video</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.engine_video.toFixed(2)}%</span>
|
||||||
|
</div>
|
||||||
|
<Progress value={combinedGPU.engine_video} className="h-2" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{combinedGPU.engine_video_enhance !== undefined && (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="text-sm text-muted-foreground">VideoEnhance</span>
|
||||||
|
<span className="text-sm font-medium">
|
||||||
|
{combinedGPU.engine_video_enhance.toFixed(2)}%
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<Progress value={combinedGPU.engine_video_enhance} className="h-2" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Memory Info */}
|
||||||
|
{combinedGPU.memory_total && (
|
||||||
|
<div className="space-y-2">
|
||||||
|
<h3 className="font-semibold text-sm">Memory</h3>
|
||||||
|
<div className="grid gap-2">
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Total</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.memory_total}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Used</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.memory_used}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between border-b border-border/50 pb-2">
|
||||||
|
<span className="text-sm text-muted-foreground">Free</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.memory_free}</span>
|
||||||
|
</div>
|
||||||
|
{combinedGPU.utilization_memory !== undefined && (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="text-sm text-muted-foreground">Memory Utilization</span>
|
||||||
|
<span className="text-sm font-medium">{combinedGPU.utilization_memory}%</span>
|
||||||
|
</div>
|
||||||
|
<Progress value={combinedGPU.utilization_memory} className="h-2" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Running Processes (NVIDIA) */}
|
||||||
|
{combinedGPU.processes && combinedGPU.processes.length > 0 && (
|
||||||
|
<div className="space-y-2">
|
||||||
|
<h3 className="font-semibold text-sm">Running Processes</h3>
|
||||||
|
<div className="space-y-2">
|
||||||
|
{combinedGPU.processes.map((proc: any, idx: number) => (
|
||||||
|
<div key={idx} className="rounded-lg border border-border/30 bg-background/50 p-3">
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="font-mono text-xs">PID: {proc.pid}</span>
|
||||||
|
<span className="text-xs font-medium">{proc.memory}</span>
|
||||||
|
</div>
|
||||||
|
<p className="mt-1 text-sm">{proc.name}</p>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>{selectedGPU.name}</DialogTitle>
|
||||||
|
<DialogDescription>PCI Device Information</DialogDescription>
|
||||||
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
{/* Basic PCI Device Information - Same format as PCI Device modal */}
|
{/* Basic PCI Device Information - Same format as PCI Device modal */}
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
@@ -474,146 +667,9 @@ export default function Hardware() {
|
|||||||
<span className="text-sm font-medium text-muted-foreground">Type</span>
|
<span className="text-sm font-medium text-muted-foreground">Type</span>
|
||||||
<span className="text-sm font-medium">{selectedGPU.type}</span>
|
<span className="text-sm font-medium">{selectedGPU.type}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{combinedGPU.driver_version && (
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm font-medium text-muted-foreground">Driver Version</span>
|
|
||||||
<span className="font-mono text-sm">{combinedGPU.driver_version}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{combinedGPU.pcie_gen && (
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm font-medium text-muted-foreground">PCIe Generation</span>
|
|
||||||
<span className="text-sm font-medium">Gen {combinedGPU.pcie_gen}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{combinedGPU.pcie_width && (
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm font-medium text-muted-foreground">PCIe Width</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.pcie_width}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Memory Info - Only show if available */}
|
{/* Extended Monitoring Not Available Message */}
|
||||||
{combinedGPU.memory_total && (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<h3 className="font-semibold text-sm">Memory</h3>
|
|
||||||
<div className="grid gap-2">
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm text-muted-foreground">Total</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.memory_total}</span>
|
|
||||||
</div>
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm text-muted-foreground">Used</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.memory_used}</span>
|
|
||||||
</div>
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm text-muted-foreground">Free</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.memory_free}</span>
|
|
||||||
</div>
|
|
||||||
{combinedGPU.utilization_memory !== undefined && (
|
|
||||||
<div className="space-y-1">
|
|
||||||
<div className="flex justify-between">
|
|
||||||
<span className="text-sm text-muted-foreground">Memory Utilization</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.utilization_memory}%</span>
|
|
||||||
</div>
|
|
||||||
<Progress value={combinedGPU.utilization_memory} className="h-2" />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Performance - Only show if realtime data available */}
|
|
||||||
{hasRealtimeData(selectedGPU, realtimeGPUData) && (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<h3 className="font-semibold text-sm">Performance</h3>
|
|
||||||
<div className="grid gap-2">
|
|
||||||
{combinedGPU.temperature !== undefined && combinedGPU.temperature > 0 && (
|
|
||||||
<div className="space-y-1">
|
|
||||||
<div className="flex justify-between">
|
|
||||||
<span className="text-sm text-muted-foreground">Temperature</span>
|
|
||||||
<span className="text-sm font-semibold text-green-500">{combinedGPU.temperature}°C</span>
|
|
||||||
</div>
|
|
||||||
<Progress value={(combinedGPU.temperature / 100) * 100} className="h-2" />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{combinedGPU.utilization_gpu !== undefined && (
|
|
||||||
<div className="space-y-1">
|
|
||||||
<div className="flex justify-between">
|
|
||||||
<span className="text-sm text-muted-foreground">GPU Utilization</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.utilization_gpu}%</span>
|
|
||||||
</div>
|
|
||||||
<Progress value={combinedGPU.utilization_gpu} className="h-2" />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{combinedGPU.power_draw && combinedGPU.power_draw !== "N/A" && (
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm text-muted-foreground">Power Draw</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.power_draw}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{combinedGPU.power_limit && (
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm text-muted-foreground">Power Limit</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.power_limit}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{combinedGPU.fan_speed && (
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm text-muted-foreground">Fan Speed</span>
|
|
||||||
<span className="text-sm font-medium">
|
|
||||||
{combinedGPU.fan_speed} {combinedGPU.fan_unit}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Clock Speeds - Only show if available */}
|
|
||||||
{(combinedGPU.clock_graphics || combinedGPU.clock_memory) && (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<h3 className="font-semibold text-sm">Clock Speeds</h3>
|
|
||||||
<div className="grid gap-2">
|
|
||||||
{combinedGPU.clock_graphics && (
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm text-muted-foreground">Graphics Clock</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.clock_graphics}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{combinedGPU.clock_memory && (
|
|
||||||
<div className="flex justify-between border-b border-border/50 pb-2">
|
|
||||||
<span className="text-sm text-muted-foreground">Memory Clock</span>
|
|
||||||
<span className="text-sm font-medium">{combinedGPU.clock_memory}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Running Processes - Only show if available */}
|
|
||||||
{combinedGPU.processes && combinedGPU.processes.length > 0 && (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<h3 className="font-semibold text-sm">Running Processes</h3>
|
|
||||||
<div className="space-y-2">
|
|
||||||
{combinedGPU.processes.map((proc: any, idx: number) => (
|
|
||||||
<div key={idx} className="rounded-lg border border-border/30 bg-background/50 p-3">
|
|
||||||
<div className="flex justify-between">
|
|
||||||
<span className="font-mono text-xs">PID: {proc.pid}</span>
|
|
||||||
<span className="text-xs font-medium">{proc.memory}</span>
|
|
||||||
</div>
|
|
||||||
<p className="mt-1 text-sm">{proc.name}</p>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!hasRealtimeData(selectedGPU, realtimeGPUData) && (
|
|
||||||
<div className="rounded-lg border border-blue-500/20 bg-blue-500/10 p-4">
|
<div className="rounded-lg border border-blue-500/20 bg-blue-500/10 p-4">
|
||||||
<div className="flex gap-3">
|
<div className="flex gap-3">
|
||||||
<Info className="h-5 w-5 text-blue-500 flex-shrink-0 mt-0.5" />
|
<Info className="h-5 w-5 text-blue-500 flex-shrink-0 mt-0.5" />
|
||||||
@@ -625,14 +681,8 @@ export default function Hardware() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
|
|
||||||
{combinedGPU.note && (
|
|
||||||
<div className="rounded-lg bg-muted p-3">
|
|
||||||
<p className="text-xs text-muted-foreground">{combinedGPU.note}</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
})()}
|
})()}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|||||||
@@ -1579,8 +1579,101 @@ def get_detailed_gpu_info(gpu):
|
|||||||
|
|
||||||
vendor = gpu.get('vendor', '').upper()
|
vendor = gpu.get('vendor', '').upper()
|
||||||
|
|
||||||
|
if vendor == 'INTEL':
|
||||||
|
try:
|
||||||
|
# Try JSON output first (newer versions of intel_gpu_top)
|
||||||
|
result = subprocess.run(
|
||||||
|
['intel_gpu_top', '-J', '-s', '100'],
|
||||||
|
capture_output=True, text=True, timeout=2
|
||||||
|
)
|
||||||
|
if result.returncode == 0 and result.stdout.strip():
|
||||||
|
try:
|
||||||
|
data = json.loads(result.stdout)
|
||||||
|
if 'frequency' in data:
|
||||||
|
detailed_info['clock_graphics'] = f"{data['frequency'].get('actual', 0)} MHz"
|
||||||
|
if 'power' in data:
|
||||||
|
detailed_info['power_draw'] = f"{data['power'].get('GPU', 0):.2f} W"
|
||||||
|
if 'engines' in data:
|
||||||
|
engines = data['engines']
|
||||||
|
detailed_info['engine_render'] = engines.get('Render/3D', {}).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_enhance'] = engines.get('VideoEnhance', {}).get('busy', 0)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Fallback to text parsing
|
||||||
|
if not detailed_info:
|
||||||
|
result = subprocess.run(
|
||||||
|
['intel_gpu_top', '-s', '100'],
|
||||||
|
capture_output=True, text=True, timeout=2
|
||||||
|
)
|
||||||
|
if result.returncode == 0:
|
||||||
|
output = result.stdout
|
||||||
|
# Parse frequency: "0/ 0 MHz"
|
||||||
|
freq_match = re.search(r'(\d+)/\s*(\d+)\s*MHz', output)
|
||||||
|
if freq_match:
|
||||||
|
detailed_info['clock_graphics'] = f"{freq_match.group(1)} MHz"
|
||||||
|
detailed_info['clock_max'] = f"{freq_match.group(2)} MHz"
|
||||||
|
|
||||||
|
# Parse power: "0.00/ 7.23 W"
|
||||||
|
power_match = re.search(r'([\d.]+)/\s*([\d.]+)\s*W', output)
|
||||||
|
if power_match:
|
||||||
|
detailed_info['power_draw'] = f"{power_match.group(1)} W"
|
||||||
|
detailed_info['power_limit'] = f"{power_match.group(2)} W"
|
||||||
|
|
||||||
|
# Parse engine utilization
|
||||||
|
engines = {
|
||||||
|
'Render/3D': 'engine_render',
|
||||||
|
'Blitter': 'engine_blitter',
|
||||||
|
'Video': 'engine_video',
|
||||||
|
'VideoEnhance': 'engine_video_enhance'
|
||||||
|
}
|
||||||
|
for engine_name, key in engines.items():
|
||||||
|
pattern = rf'{engine_name}\s+([\d.]+)%'
|
||||||
|
match = re.search(pattern, output)
|
||||||
|
if match:
|
||||||
|
detailed_info[key] = float(match.group(1))
|
||||||
|
|
||||||
|
print(f"[v0] Intel GPU parsed data: {detailed_info}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error getting Intel GPU details: {e}")
|
||||||
|
|
||||||
|
elif vendor == 'AMD' or 'ATI' in vendor:
|
||||||
|
try:
|
||||||
|
result = subprocess.run(
|
||||||
|
['radeontop', '-d', '-', '-l', '1'],
|
||||||
|
capture_output=True, text=True, timeout=2
|
||||||
|
)
|
||||||
|
if result.returncode == 0:
|
||||||
|
output = result.stdout
|
||||||
|
# Parse GPU utilization: "gpu 45.00%"
|
||||||
|
gpu_match = re.search(r'gpu\s+([\d.]+)%', output)
|
||||||
|
if gpu_match:
|
||||||
|
detailed_info['utilization_gpu'] = float(gpu_match.group(1))
|
||||||
|
|
||||||
|
# Parse memory utilization: "vram 23.45%"
|
||||||
|
vram_match = re.search(r'vram\s+([\d.]+)%', output)
|
||||||
|
if vram_match:
|
||||||
|
detailed_info['utilization_memory'] = float(vram_match.group(1))
|
||||||
|
|
||||||
|
# Parse clocks: "sclk 1.20ghz, mclk 0.95ghz"
|
||||||
|
sclk_match = re.search(r'sclk\s+([\d.]+)ghz', output, re.IGNORECASE)
|
||||||
|
if sclk_match:
|
||||||
|
detailed_info['clock_graphics'] = f"{float(sclk_match.group(1)) * 1000:.0f} MHz"
|
||||||
|
|
||||||
|
mclk_match = re.search(r'mclk\s+([\d.]+)ghz', output, re.IGNORECASE)
|
||||||
|
if mclk_match:
|
||||||
|
detailed_info['clock_memory'] = f"{float(mclk_match.group(1)) * 1000:.0f} MHz"
|
||||||
|
|
||||||
|
print(f"[v0] AMD GPU parsed data: {detailed_info}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error getting AMD GPU details: {e}")
|
||||||
|
|
||||||
# NVIDIA GPU - use nvidia-smi
|
# NVIDIA GPU - use nvidia-smi
|
||||||
if vendor == 'NVIDIA':
|
elif vendor == 'NVIDIA':
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['nvidia-smi', '--query-gpu=index,name,driver_version,memory.total,memory.used,memory.free,temperature.gpu,power.draw,power.limit,utilization.gpu,utilization.memory,clocks.gr,clocks.mem,pcie.link.gen.current,pcie.link.width.current',
|
['nvidia-smi', '--query-gpu=index,name,driver_version,memory.total,memory.used,memory.free,temperature.gpu,power.draw,power.limit,utilization.gpu,utilization.memory,clocks.gr,clocks.mem,pcie.link.gen.current,pcie.link.width.current',
|
||||||
@@ -1630,113 +1723,6 @@ def get_detailed_gpu_info(gpu):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[v0] Error getting NVIDIA GPU details: {e}")
|
print(f"[v0] Error getting NVIDIA GPU details: {e}")
|
||||||
|
|
||||||
elif vendor == 'INTEL':
|
|
||||||
try:
|
|
||||||
# Try to run intel_gpu_top with JSON output for 1 second
|
|
||||||
result = subprocess.run(
|
|
||||||
['timeout', '2', 'intel_gpu_top', '-J'],
|
|
||||||
capture_output=True, text=True, timeout=3
|
|
||||||
)
|
|
||||||
|
|
||||||
if result.returncode == 0 or result.returncode == 124: # 124 is timeout exit code
|
|
||||||
output = result.stdout.strip()
|
|
||||||
if output:
|
|
||||||
try:
|
|
||||||
# Parse JSON output
|
|
||||||
import json
|
|
||||||
data = json.loads(output)
|
|
||||||
|
|
||||||
# Extract frequency info
|
|
||||||
if 'frequency' in data:
|
|
||||||
freq = data['frequency']
|
|
||||||
if 'actual' in freq:
|
|
||||||
detailed_info['clock_graphics'] = f"{freq['actual']} MHz"
|
|
||||||
|
|
||||||
# Extract power info
|
|
||||||
if 'power' in data:
|
|
||||||
power = data['power']
|
|
||||||
if 'GPU' in power:
|
|
||||||
detailed_info['power_draw'] = f"{power['GPU']:.2f} W"
|
|
||||||
|
|
||||||
# Extract engine utilization
|
|
||||||
if 'engines' in data:
|
|
||||||
engines = data['engines']
|
|
||||||
total_busy = 0
|
|
||||||
engine_count = 0
|
|
||||||
|
|
||||||
for engine_name, engine_data in engines.items():
|
|
||||||
if 'busy' in engine_data:
|
|
||||||
total_busy += engine_data['busy']
|
|
||||||
engine_count += 1
|
|
||||||
|
|
||||||
if engine_count > 0:
|
|
||||||
detailed_info['utilization_gpu'] = int(total_busy / engine_count)
|
|
||||||
|
|
||||||
print(f"[v0] Intel GPU data parsed from JSON: {detailed_info}")
|
|
||||||
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
print(f"[v0] Failed to parse intel_gpu_top JSON output")
|
|
||||||
|
|
||||||
# Fallback: Try text output parsing
|
|
||||||
if not detailed_info:
|
|
||||||
result = subprocess.run(
|
|
||||||
['timeout', '2', 'intel_gpu_top', '-s', '1000'],
|
|
||||||
capture_output=True, text=True, timeout=3
|
|
||||||
)
|
|
||||||
|
|
||||||
if result.returncode == 0 or result.returncode == 124:
|
|
||||||
output = result.stdout.strip()
|
|
||||||
print(f"[v0] Intel GPU top output: {output[:200]}")
|
|
||||||
|
|
||||||
# Parse frequency (e.g., "0/ 0 MHz")
|
|
||||||
freq_match = re.search(r'(\d+)/\s*(\d+)\s*MHz', output)
|
|
||||||
if freq_match:
|
|
||||||
actual_freq = freq_match.group(1)
|
|
||||||
if int(actual_freq) > 0:
|
|
||||||
detailed_info['clock_graphics'] = f"{actual_freq} MHz"
|
|
||||||
|
|
||||||
# Parse power (e.g., "0.00/ 7.23 W")
|
|
||||||
power_match = re.search(r'([\d.]+)/\s*([\d.]+)\s*W', output)
|
|
||||||
if power_match:
|
|
||||||
actual_power = float(power_match.group(1))
|
|
||||||
max_power = float(power_match.group(2))
|
|
||||||
if actual_power > 0 or max_power > 0:
|
|
||||||
detailed_info['power_draw'] = f"{actual_power:.2f} W"
|
|
||||||
detailed_info['power_limit'] = f"{max_power:.2f} W"
|
|
||||||
|
|
||||||
# Parse engine utilization (e.g., "Render/3D 0.00%")
|
|
||||||
engine_lines = re.findall(r'(Render/3D|Blitter|Video|VideoEnhance)\s+([\d.]+)%', output)
|
|
||||||
if engine_lines:
|
|
||||||
total_util = sum(float(util) for _, util in engine_lines)
|
|
||||||
avg_util = total_util / len(engine_lines)
|
|
||||||
if avg_util > 0:
|
|
||||||
detailed_info['utilization_gpu'] = int(avg_util)
|
|
||||||
|
|
||||||
print(f"[v0] Intel GPU data parsed from text: {detailed_info}")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"[v0] Error getting Intel GPU details: {e}")
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|
||||||
# AMD GPU - use radeontop
|
|
||||||
elif vendor == 'AMD':
|
|
||||||
try:
|
|
||||||
result = subprocess.run(
|
|
||||||
['radeontop', '-d', '-', '-l', '1'],
|
|
||||||
capture_output=True, text=True, timeout=2
|
|
||||||
)
|
|
||||||
if result.returncode == 0:
|
|
||||||
# Parse radeontop output
|
|
||||||
# This is a simplified version, actual parsing would be more complex
|
|
||||||
for line in result.stdout.split('\n'):
|
|
||||||
if 'gpu' in line.lower():
|
|
||||||
match = re.search(r'(\d+\.\d+)%', line)
|
|
||||||
if match:
|
|
||||||
detailed_info['utilization_gpu'] = float(match.group(1))
|
|
||||||
except Exception as e:
|
|
||||||
print(f"[v0] Error getting AMD GPU details: {e}")
|
|
||||||
|
|
||||||
return detailed_info
|
return detailed_info
|
||||||
|
|
||||||
def get_pci_device_info(pci_slot):
|
def get_pci_device_info(pci_slot):
|
||||||
@@ -1826,6 +1812,172 @@ def get_network_hardware_info(pci_slot):
|
|||||||
|
|
||||||
return net_info
|
return net_info
|
||||||
|
|
||||||
|
def get_gpu_info():
|
||||||
|
"""Get GPU information from lspci and enrich with temperature/fan data from sensors"""
|
||||||
|
gpus = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = subprocess.run(['lspci'], capture_output=True, text=True, timeout=5)
|
||||||
|
if result.returncode == 0:
|
||||||
|
for line in result.stdout.split('\n'):
|
||||||
|
# Match VGA, 3D, Display controllers
|
||||||
|
if any(keyword in line for keyword in ['VGA compatible controller', '3D controller', 'Display controller']):
|
||||||
|
parts = line.split(':', 2)
|
||||||
|
if len(parts) >= 3:
|
||||||
|
slot = parts[0].strip()
|
||||||
|
gpu_name = parts[2].strip()
|
||||||
|
|
||||||
|
# Determine vendor
|
||||||
|
vendor = 'Unknown'
|
||||||
|
if 'NVIDIA' in gpu_name or 'nVidia' in gpu_name:
|
||||||
|
vendor = 'NVIDIA'
|
||||||
|
elif 'AMD' in gpu_name or 'ATI' in gpu_name or 'Radeon' in gpu_name:
|
||||||
|
vendor = 'AMD'
|
||||||
|
elif 'Intel' in gpu_name:
|
||||||
|
vendor = 'Intel'
|
||||||
|
|
||||||
|
gpu = {
|
||||||
|
'slot': slot,
|
||||||
|
'name': gpu_name,
|
||||||
|
'vendor': vendor,
|
||||||
|
'type': 'Discrete' if vendor in ['NVIDIA', 'AMD'] else 'Integrated'
|
||||||
|
}
|
||||||
|
|
||||||
|
pci_info = get_pci_device_info(slot)
|
||||||
|
if pci_info:
|
||||||
|
gpu['pci_class'] = pci_info.get('class', '')
|
||||||
|
gpu['pci_driver'] = pci_info.get('driver', '')
|
||||||
|
gpu['pci_kernel_module'] = pci_info.get('kernel_module', '')
|
||||||
|
|
||||||
|
detailed_info = get_detailed_gpu_info(gpu)
|
||||||
|
gpu.update(detailed_info)
|
||||||
|
|
||||||
|
gpus.append(gpu)
|
||||||
|
print(f"[v0] Found GPU: {gpu_name} ({vendor}) at slot {slot}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error detecting GPUs from lspci: {e}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = subprocess.run(['sensors'], capture_output=True, text=True, timeout=5)
|
||||||
|
if result.returncode == 0:
|
||||||
|
current_adapter = None
|
||||||
|
|
||||||
|
for line in result.stdout.split('\n'):
|
||||||
|
line = line.strip()
|
||||||
|
if not line:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Detect adapter line
|
||||||
|
if line.startswith('Adapter:'):
|
||||||
|
current_adapter = line.replace('Adapter:', '').strip()
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Look for GPU-related sensors (nouveau, amdgpu, radeon, i915, etc.)
|
||||||
|
if ':' in line and not line.startswith(' '):
|
||||||
|
parts = line.split(':', 1)
|
||||||
|
sensor_name = parts[0].strip()
|
||||||
|
value_part = parts[1].strip()
|
||||||
|
|
||||||
|
# Check if this is a GPU sensor
|
||||||
|
gpu_sensor_keywords = ['nouveau', 'amdgpu', 'radeon', 'i915']
|
||||||
|
is_gpu_sensor = any(keyword in current_adapter.lower() if current_adapter else False for keyword in gpu_sensor_keywords)
|
||||||
|
|
||||||
|
if is_gpu_sensor:
|
||||||
|
# Try to match this sensor to a GPU
|
||||||
|
for gpu in gpus:
|
||||||
|
# Match nouveau to NVIDIA, amdgpu/radeon to AMD, i915 to Intel
|
||||||
|
if (('nouveau' in current_adapter.lower() and gpu['vendor'] == 'NVIDIA') or
|
||||||
|
(('amdgpu' in current_adapter.lower() or 'radeon' in current_adapter.lower()) and gpu['vendor'] == 'AMD') or
|
||||||
|
('i915' in current_adapter.lower() and gpu['vendor'] == 'Intel')):
|
||||||
|
|
||||||
|
# Parse temperature (only if not already set by nvidia-smi)
|
||||||
|
if '°C' in value_part or 'C' in value_part:
|
||||||
|
if 'temperature' not in gpu or gpu['temperature'] is None:
|
||||||
|
temp_match = re.search(r'([+-]?[\d.]+)\s*°?C', value_part)
|
||||||
|
if temp_match:
|
||||||
|
gpu['temperature'] = float(temp_match.group(1))
|
||||||
|
print(f"[v0] GPU {gpu['name']}: Temperature = {gpu['temperature']}°C")
|
||||||
|
|
||||||
|
# Parse fan speed
|
||||||
|
elif 'RPM' in value_part:
|
||||||
|
rpm_match = re.search(r'([\d.]+)\s*RPM', value_part)
|
||||||
|
if rpm_match:
|
||||||
|
gpu['fan_speed'] = int(float(rpm_match.group(1)))
|
||||||
|
gpu['fan_unit'] = 'RPM'
|
||||||
|
print(f"[v0] GPU {gpu['name']}: Fan = {gpu['fan_speed']} RPM")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error enriching GPU data from sensors: {e}")
|
||||||
|
|
||||||
|
return gpus
|
||||||
|
|
||||||
|
def get_disk_hardware_info(disk_name):
|
||||||
|
"""Get detailed hardware information for a disk"""
|
||||||
|
disk_info = {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Get disk type (HDD, SSD, NVMe)
|
||||||
|
result = subprocess.run(['lsblk', '-d', '-n', '-o', 'NAME,ROTA,TYPE', f'/dev/{disk_name}'],
|
||||||
|
capture_output=True, text=True, timeout=5)
|
||||||
|
if result.returncode == 0:
|
||||||
|
parts = result.stdout.strip().split()
|
||||||
|
if len(parts) >= 2:
|
||||||
|
rota = parts[1]
|
||||||
|
disk_info['type'] = 'HDD' if rota == '1' else 'SSD'
|
||||||
|
if disk_name.startswith('nvme'):
|
||||||
|
disk_info['type'] = 'NVMe SSD'
|
||||||
|
|
||||||
|
# Get driver/kernel module
|
||||||
|
try:
|
||||||
|
# For NVMe
|
||||||
|
if disk_name.startswith('nvme'):
|
||||||
|
disk_info['driver'] = 'nvme'
|
||||||
|
disk_info['interface'] = 'PCIe/NVMe'
|
||||||
|
# For SATA/SAS
|
||||||
|
else:
|
||||||
|
result = subprocess.run(['udevadm', 'info', '--query=property', f'/dev/{disk_name}'],
|
||||||
|
capture_output=True, text=True, timeout=5)
|
||||||
|
if result.returncode == 0:
|
||||||
|
for line in result.stdout.split('\n'):
|
||||||
|
if 'ID_BUS=' in line:
|
||||||
|
bus = line.split('=')[1].strip()
|
||||||
|
disk_info['interface'] = bus.upper()
|
||||||
|
if 'ID_MODEL=' in line:
|
||||||
|
model = line.split('=')[1].strip()
|
||||||
|
disk_info['model'] = model
|
||||||
|
if 'ID_SERIAL_SHORT=' in line:
|
||||||
|
serial = line.split('=')[1].strip()
|
||||||
|
disk_info['serial'] = serial
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error getting disk driver info: {e}")
|
||||||
|
|
||||||
|
# Get SMART data
|
||||||
|
try:
|
||||||
|
result = subprocess.run(['smartctl', '-i', f'/dev/{disk_name}'],
|
||||||
|
capture_output=True, text=True, timeout=5)
|
||||||
|
if result.returncode == 0:
|
||||||
|
for line in result.stdout.split('\n'):
|
||||||
|
if 'Model Family:' in line:
|
||||||
|
disk_info['family'] = line.split(':', 1)[1].strip()
|
||||||
|
elif 'Device Model:' in line or 'Model Number:' in line:
|
||||||
|
disk_info['model'] = line.split(':', 1)[1].strip()
|
||||||
|
elif 'Serial Number:' in line:
|
||||||
|
disk_info['serial'] = line.split(':', 1)[1].strip()
|
||||||
|
elif 'Firmware Version:' in line:
|
||||||
|
disk_info['firmware'] = line.split(':', 1)[1].strip()
|
||||||
|
elif 'Rotation Rate:' in line:
|
||||||
|
disk_info['rotation_rate'] = line.split(':', 1)[1].strip()
|
||||||
|
elif 'Form Factor:' in line:
|
||||||
|
disk_info['form_factor'] = line.split(':', 1)[1].strip()
|
||||||
|
elif 'SATA Version is:' in line:
|
||||||
|
disk_info['sata_version'] = line.split(':', 1)[1].strip()
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error getting SMART info: {e}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error getting disk hardware info: {e}")
|
||||||
|
|
||||||
|
return disk_info
|
||||||
|
|
||||||
def get_hardware_info():
|
def get_hardware_info():
|
||||||
"""Get comprehensive hardware information"""
|
"""Get comprehensive hardware information"""
|
||||||
try:
|
try:
|
||||||
@@ -1983,7 +2135,7 @@ def get_hardware_info():
|
|||||||
hardware_data['graphics_cards'].append({
|
hardware_data['graphics_cards'].append({
|
||||||
'name': parts[0].strip(),
|
'name': parts[0].strip(),
|
||||||
'memory': parts[1].strip(),
|
'memory': parts[1].strip(),
|
||||||
'temperature': int(float(parts[2].strip().split(' ')[0])) if parts[2].strip() != 'N/A' and 'C' in parts[2] else 0,
|
'temperature': int(parts[2].strip().split(' ')[0]) if parts[2].strip() != 'N/A' and 'C' in parts[2] else 0,
|
||||||
'power_draw': parts[3].strip(),
|
'power_draw': parts[3].strip(),
|
||||||
'vendor': 'NVIDIA'
|
'vendor': 'NVIDIA'
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user