diff --git a/AppImage/components/hardware.tsx b/AppImage/components/hardware.tsx index fab6d4b..c524b14 100644 --- a/AppImage/components/hardware.tsx +++ b/AppImage/components/hardware.tsx @@ -16,6 +16,7 @@ import { Cpu, MemoryStick, Cpu as Gpu, + Info, } from "lucide-react" import useSWR from "swr" import { useState } from "react" @@ -38,6 +39,29 @@ const getDeviceTypeColor = (type: string): string => { return "bg-gray-500/10 text-gray-500 border-gray-500/20" } +const hasRealtimeData = (gpu: GPU): boolean => { + return !!( + (gpu.temperature !== undefined && gpu.temperature > 0) || + gpu.utilization_gpu !== undefined || + gpu.memory_total || + gpu.power_draw + ) +} + +const getMonitoringToolRecommendation = (vendor: string): string => { + const lowerVendor = vendor.toLowerCase() + if (lowerVendor.includes("intel")) { + return "To get extended GPU monitoring information, please install intel-gpu-tools or igt-gpu-tools package." + } + if (lowerVendor.includes("nvidia")) { + return "To get extended GPU monitoring information, please install nvidia-utils or nvidia-smi package." + } + if (lowerVendor.includes("amd") || lowerVendor.includes("ati")) { + return "To get extended GPU monitoring information, please install radeontop package." + } + return "To get extended GPU monitoring information, please install the appropriate GPU monitoring tools for your hardware." +} + export default function Hardware() { const { data: hardwareData, error } = useSWR("/api/hardware", fetcher, { refreshInterval: 5000, @@ -442,49 +466,51 @@ export default function Hardware() { )} {/* Performance */} -
-

Performance

-
- {selectedGPU.temperature !== undefined && selectedGPU.temperature > 0 && ( -
-
- Temperature - {selectedGPU.temperature}°C + {hasRealtimeData(selectedGPU) && ( +
+

Performance

+
+ {selectedGPU.temperature !== undefined && selectedGPU.temperature > 0 && ( +
+
+ Temperature + {selectedGPU.temperature}°C +
+
- -
- )} - {selectedGPU.utilization_gpu !== undefined && ( -
-
- GPU Utilization - {selectedGPU.utilization_gpu}% + )} + {selectedGPU.utilization_gpu !== undefined && ( +
+
+ GPU Utilization + {selectedGPU.utilization_gpu}% +
+
- -
- )} - {selectedGPU.power_draw && selectedGPU.power_draw !== "N/A" && ( -
- Power Draw - {selectedGPU.power_draw} -
- )} - {selectedGPU.power_limit && ( -
- Power Limit - {selectedGPU.power_limit} -
- )} - {selectedGPU.fan_speed && ( -
- Fan Speed - - {selectedGPU.fan_speed} {selectedGPU.fan_unit} - -
- )} + )} + {selectedGPU.power_draw && selectedGPU.power_draw !== "N/A" && ( +
+ Power Draw + {selectedGPU.power_draw} +
+ )} + {selectedGPU.power_limit && ( +
+ Power Limit + {selectedGPU.power_limit} +
+ )} + {selectedGPU.fan_speed && ( +
+ Fan Speed + + {selectedGPU.fan_speed} {selectedGPU.fan_unit} + +
+ )} +
-
+ )} {/* Clock Speeds */} {(selectedGPU.clock_graphics || selectedGPU.clock_memory) && ( @@ -525,6 +551,20 @@ export default function Hardware() {
)} + {!hasRealtimeData(selectedGPU) && ( +
+
+ +
+

Extended Monitoring Not Available

+

+ {getMonitoringToolRecommendation(selectedGPU.vendor)} +

+
+
+
+ )} + {selectedGPU.note && (

{selectedGPU.note}