diff --git a/web/src/types/stats.ts b/web/src/types/stats.ts index a4f5605e1..2affdc1e8 100644 --- a/web/src/types/stats.ts +++ b/web/src/types/stats.ts @@ -41,6 +41,9 @@ export type ExtraProcessStats = { export type GpuStats = { gpu: string; mem: string; + enc?: string; + dec?: string; + pstate?: string; }; export type ServiceStats = { diff --git a/web/src/views/system/GeneralMetrics.tsx b/web/src/views/system/GeneralMetrics.tsx index 112c85684..2d63d9a83 100644 --- a/web/src/views/system/GeneralMetrics.tsx +++ b/web/src/views/system/GeneralMetrics.tsx @@ -14,6 +14,7 @@ import { Button } from "@/components/ui/button"; import VainfoDialog from "@/components/overlay/VainfoDialog"; import { Skeleton } from "@/components/ui/skeleton"; import { ThresholdBarGraph } from "@/components/graph/SystemGraph"; +import { cn } from "@/lib/utils"; type GeneralMetricsProps = { lastUpdated: number; @@ -108,7 +109,7 @@ export default function GeneralMetrics({ const detTempSeries = useMemo(() => { if (!statsHistory) { - return []; + return undefined; } if ( @@ -291,6 +292,74 @@ export default function GeneralMetrics({ return Object.values(series); }, [statsHistory]); + const gpuEncSeries = useMemo(() => { + if (!statsHistory) { + return []; + } + + const series: { + [key: string]: { name: string; data: { x: number; y: string }[] }; + } = {}; + let hasValidGpu = false; + + statsHistory.forEach((stats, statsIdx) => { + if (!stats) { + return; + } + + Object.entries(stats.gpu_usages || []).forEach(([key, stats]) => { + if (!(key in series)) { + series[key] = { name: key, data: [] }; + } + + if (stats.enc) { + hasValidGpu = true; + series[key].data.push({ x: statsIdx + 1, y: stats.enc.slice(0, -1) }); + } + }); + }); + + if (!hasValidGpu) { + return []; + } + + return Object.keys(series).length > 0 ? Object.values(series) : undefined; + }, [statsHistory]); + + const gpuDecSeries = useMemo(() => { + if (!statsHistory) { + return []; + } + + const series: { + [key: string]: { name: string; data: { x: number; y: string }[] }; + } = {}; + let hasValidGpu = false; + + statsHistory.forEach((stats, statsIdx) => { + if (!stats) { + return; + } + + Object.entries(stats.gpu_usages || []).forEach(([key, stats]) => { + if (!(key in series)) { + series[key] = { name: key, data: [] }; + } + + if (stats.dec) { + hasValidGpu = true; + series[key].data.push({ x: statsIdx + 1, y: stats.dec.slice(0, -1) }); + } + }); + }); + + if (!hasValidGpu) { + return []; + } + + return Object.keys(series).length > 0 ? Object.values(series) : undefined; + }, [statsHistory]); + // other processes stats const otherProcessCpuSeries = useMemo(() => { @@ -370,7 +439,10 @@ export default function GeneralMetrics({ Detectors