2024-04-04 19:24:23 +03:00
|
|
|
import useSWR from "swr";
|
|
|
|
|
import { FrigateStats } from "@/types/stats";
|
|
|
|
|
import { useEffect, useMemo, useState } from "react";
|
|
|
|
|
import { useFrigateStats } from "@/api/ws";
|
|
|
|
|
import {
|
|
|
|
|
DetectorCpuThreshold,
|
|
|
|
|
DetectorMemThreshold,
|
2024-04-19 06:34:16 +03:00
|
|
|
DetectorTempThreshold,
|
2024-04-04 19:24:23 +03:00
|
|
|
GPUMemThreshold,
|
|
|
|
|
GPUUsageThreshold,
|
|
|
|
|
InferenceThreshold,
|
|
|
|
|
} from "@/types/graph";
|
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import VainfoDialog from "@/components/overlay/VainfoDialog";
|
|
|
|
|
import { ThresholdBarGraph } from "@/components/graph/SystemGraph";
|
|
|
|
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
|
|
|
|
|
|
|
|
type GeneralMetricsProps = {
|
|
|
|
|
lastUpdated: number;
|
|
|
|
|
setLastUpdated: (last: number) => void;
|
|
|
|
|
};
|
|
|
|
|
export default function GeneralMetrics({
|
|
|
|
|
lastUpdated,
|
|
|
|
|
setLastUpdated,
|
|
|
|
|
}: GeneralMetricsProps) {
|
|
|
|
|
// extra info
|
|
|
|
|
|
|
|
|
|
const [showVainfo, setShowVainfo] = useState(false);
|
|
|
|
|
|
|
|
|
|
// stats
|
|
|
|
|
|
|
|
|
|
const { data: initialStats } = useSWR<FrigateStats[]>(
|
|
|
|
|
[
|
|
|
|
|
"stats/history",
|
|
|
|
|
{ keys: "cpu_usages,detectors,gpu_usages,processes,service" },
|
|
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
revalidateOnFocus: false,
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const [statsHistory, setStatsHistory] = useState<FrigateStats[]>([]);
|
|
|
|
|
const { payload: updatedStats } = useFrigateStats();
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (initialStats == undefined || initialStats.length == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (statsHistory.length == 0) {
|
|
|
|
|
setStatsHistory(initialStats);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!updatedStats) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (updatedStats.service.last_updated > lastUpdated) {
|
|
|
|
|
setStatsHistory([...statsHistory, updatedStats]);
|
|
|
|
|
setLastUpdated(Date.now() / 1000);
|
|
|
|
|
}
|
|
|
|
|
}, [initialStats, updatedStats, statsHistory, lastUpdated, setLastUpdated]);
|
|
|
|
|
|
2024-04-04 23:55:04 +03:00
|
|
|
const canGetGpuInfo = useMemo(
|
|
|
|
|
() =>
|
|
|
|
|
statsHistory.length > 0 &&
|
|
|
|
|
Object.keys(statsHistory[0]?.gpu_usages ?? {}).filter(
|
|
|
|
|
(key) =>
|
|
|
|
|
key == "amd-vaapi" || key == "intel-vaapi" || key == "intel-qsv",
|
|
|
|
|
).length > 0,
|
|
|
|
|
[statsHistory],
|
|
|
|
|
);
|
|
|
|
|
|
2024-04-04 19:24:23 +03:00
|
|
|
// timestamps
|
|
|
|
|
|
|
|
|
|
const updateTimes = useMemo(
|
|
|
|
|
() => statsHistory.map((stats) => stats.service.last_updated),
|
|
|
|
|
[statsHistory],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// detectors stats
|
|
|
|
|
|
|
|
|
|
const detInferenceTimeSeries = useMemo(() => {
|
|
|
|
|
if (!statsHistory) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const series: {
|
|
|
|
|
[key: string]: { name: string; data: { x: number; y: number }[] };
|
|
|
|
|
} = {};
|
|
|
|
|
|
|
|
|
|
statsHistory.forEach((stats, statsIdx) => {
|
|
|
|
|
if (!stats) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.entries(stats.detectors).forEach(([key, stats]) => {
|
|
|
|
|
if (!(key in series)) {
|
|
|
|
|
series[key] = { name: key, data: [] };
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-07 23:36:28 +03:00
|
|
|
series[key].data.push({ x: statsIdx + 1, y: stats.inference_speed });
|
2024-04-04 19:24:23 +03:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return Object.values(series);
|
|
|
|
|
}, [statsHistory]);
|
|
|
|
|
|
2024-04-19 06:34:16 +03:00
|
|
|
const detTempSeries = useMemo(() => {
|
|
|
|
|
if (!statsHistory) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
statsHistory.length > 0 &&
|
|
|
|
|
Object.keys(statsHistory[0].service.temperatures).length == 0
|
|
|
|
|
) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const series: {
|
|
|
|
|
[key: string]: { name: string; data: { x: number; y: number }[] };
|
|
|
|
|
} = {};
|
|
|
|
|
|
|
|
|
|
statsHistory.forEach((stats, statsIdx) => {
|
|
|
|
|
if (!stats) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.entries(stats.detectors).forEach(([key], cIdx) => {
|
|
|
|
|
if (cIdx <= Object.keys(stats.service.temperatures).length) {
|
|
|
|
|
if (!(key in series)) {
|
|
|
|
|
series[key] = {
|
|
|
|
|
name: key,
|
|
|
|
|
data: [],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const temp = Object.values(stats.service.temperatures)[cIdx];
|
|
|
|
|
series[key].data.push({ x: statsIdx + 1, y: Math.round(temp) });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return Object.values(series);
|
|
|
|
|
}, [statsHistory]);
|
|
|
|
|
|
2024-04-04 19:24:23 +03:00
|
|
|
const detCpuSeries = useMemo(() => {
|
|
|
|
|
if (!statsHistory) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const series: {
|
|
|
|
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
|
|
|
|
} = {};
|
|
|
|
|
|
|
|
|
|
statsHistory.forEach((stats, statsIdx) => {
|
|
|
|
|
if (!stats) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.entries(stats.detectors).forEach(([key, detStats]) => {
|
|
|
|
|
if (!(key in series)) {
|
|
|
|
|
series[key] = { name: key, data: [] };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
series[key].data.push({
|
2024-04-07 23:36:28 +03:00
|
|
|
x: statsIdx + 1,
|
2024-04-04 19:24:23 +03:00
|
|
|
y: stats.cpu_usages[detStats.pid.toString()].cpu,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return Object.values(series);
|
|
|
|
|
}, [statsHistory]);
|
|
|
|
|
|
|
|
|
|
const detMemSeries = useMemo(() => {
|
|
|
|
|
if (!statsHistory) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const series: {
|
|
|
|
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
|
|
|
|
} = {};
|
|
|
|
|
|
|
|
|
|
statsHistory.forEach((stats, statsIdx) => {
|
|
|
|
|
if (!stats) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.entries(stats.detectors).forEach(([key, detStats]) => {
|
|
|
|
|
if (!(key in series)) {
|
|
|
|
|
series[key] = { name: key, data: [] };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
series[key].data.push({
|
2024-04-07 23:36:28 +03:00
|
|
|
x: statsIdx + 1,
|
2024-04-04 19:24:23 +03:00
|
|
|
y: stats.cpu_usages[detStats.pid.toString()].mem,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return Object.values(series);
|
|
|
|
|
}, [statsHistory]);
|
|
|
|
|
|
|
|
|
|
// gpu stats
|
|
|
|
|
|
|
|
|
|
const gpuSeries = useMemo(() => {
|
|
|
|
|
if (!statsHistory) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const series: {
|
|
|
|
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
|
|
|
|
} = {};
|
2024-04-27 19:26:51 +03:00
|
|
|
let hasValidGpu = false;
|
2024-04-04 19:24:23 +03:00
|
|
|
|
|
|
|
|
statsHistory.forEach((stats, statsIdx) => {
|
|
|
|
|
if (!stats) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.entries(stats.gpu_usages || []).forEach(([key, stats]) => {
|
|
|
|
|
if (!(key in series)) {
|
|
|
|
|
series[key] = { name: key, data: [] };
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-27 19:26:51 +03:00
|
|
|
if (stats.gpu) {
|
|
|
|
|
hasValidGpu = true;
|
|
|
|
|
series[key].data.push({ x: statsIdx + 1, y: stats.gpu.slice(0, -1) });
|
|
|
|
|
}
|
2024-04-04 19:24:23 +03:00
|
|
|
});
|
|
|
|
|
});
|
2024-04-27 19:26:51 +03:00
|
|
|
|
|
|
|
|
if (!hasValidGpu) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-04 19:24:23 +03:00
|
|
|
return Object.keys(series).length > 0 ? Object.values(series) : [];
|
|
|
|
|
}, [statsHistory]);
|
|
|
|
|
|
|
|
|
|
const gpuMemSeries = useMemo(() => {
|
|
|
|
|
if (!statsHistory) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-10 02:08:11 +03:00
|
|
|
if (
|
|
|
|
|
Object.keys(statsHistory?.at(0)?.gpu_usages ?? {}).length == 1 &&
|
|
|
|
|
Object.keys(statsHistory?.at(0)?.gpu_usages ?? {})[0].includes("intel")
|
|
|
|
|
) {
|
|
|
|
|
// intel gpu stats do not support memory
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-04 19:24:23 +03:00
|
|
|
const series: {
|
|
|
|
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
|
|
|
|
} = {};
|
2024-04-27 19:26:51 +03:00
|
|
|
let hasValidGpu = false;
|
2024-04-04 19:24:23 +03:00
|
|
|
|
|
|
|
|
statsHistory.forEach((stats, statsIdx) => {
|
|
|
|
|
if (!stats) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.entries(stats.gpu_usages || {}).forEach(([key, stats]) => {
|
|
|
|
|
if (!(key in series)) {
|
|
|
|
|
series[key] = { name: key, data: [] };
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-27 19:26:51 +03:00
|
|
|
if (stats.mem) {
|
|
|
|
|
hasValidGpu = true;
|
|
|
|
|
series[key].data.push({ x: statsIdx + 1, y: stats.mem.slice(0, -1) });
|
|
|
|
|
}
|
2024-04-04 19:24:23 +03:00
|
|
|
});
|
|
|
|
|
});
|
2024-04-27 19:26:51 +03:00
|
|
|
|
|
|
|
|
if (!hasValidGpu) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-04 19:24:23 +03:00
|
|
|
return Object.values(series);
|
|
|
|
|
}, [statsHistory]);
|
|
|
|
|
|
|
|
|
|
// other processes stats
|
|
|
|
|
|
|
|
|
|
const otherProcessCpuSeries = useMemo(() => {
|
|
|
|
|
if (!statsHistory) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const series: {
|
|
|
|
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
|
|
|
|
} = {};
|
|
|
|
|
|
|
|
|
|
statsHistory.forEach((stats, statsIdx) => {
|
|
|
|
|
if (!stats) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.entries(stats.processes).forEach(([key, procStats]) => {
|
|
|
|
|
if (procStats.pid.toString() in stats.cpu_usages) {
|
|
|
|
|
if (!(key in series)) {
|
|
|
|
|
series[key] = { name: key, data: [] };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
series[key].data.push({
|
2024-04-07 23:36:28 +03:00
|
|
|
x: statsIdx + 1,
|
2024-04-04 19:24:23 +03:00
|
|
|
y: stats.cpu_usages[procStats.pid.toString()].cpu,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return Object.keys(series).length > 0 ? Object.values(series) : [];
|
|
|
|
|
}, [statsHistory]);
|
|
|
|
|
|
|
|
|
|
const otherProcessMemSeries = useMemo(() => {
|
|
|
|
|
if (!statsHistory) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const series: {
|
|
|
|
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
|
|
|
|
} = {};
|
|
|
|
|
|
|
|
|
|
statsHistory.forEach((stats, statsIdx) => {
|
|
|
|
|
if (!stats) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.entries(stats.processes).forEach(([key, procStats]) => {
|
|
|
|
|
if (procStats.pid.toString() in stats.cpu_usages) {
|
|
|
|
|
if (!(key in series)) {
|
|
|
|
|
series[key] = { name: key, data: [] };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
series[key].data.push({
|
2024-04-07 23:36:28 +03:00
|
|
|
x: statsIdx + 1,
|
2024-04-04 19:24:23 +03:00
|
|
|
y: stats.cpu_usages[procStats.pid.toString()].mem,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return Object.values(series);
|
|
|
|
|
}, [statsHistory]);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<VainfoDialog showVainfo={showVainfo} setShowVainfo={setShowVainfo} />
|
|
|
|
|
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="mt-4 flex size-full flex-col overflow-y-auto">
|
|
|
|
|
<div className="text-sm font-medium text-muted-foreground">
|
2024-04-04 19:24:23 +03:00
|
|
|
Detectors
|
|
|
|
|
</div>
|
2024-04-19 06:34:16 +03:00
|
|
|
<div
|
2024-05-14 18:06:44 +03:00
|
|
|
className={`mt-4 grid w-full grid-cols-1 gap-2 ${detTempSeries == undefined ? "sm:grid-cols-3" : "sm:grid-cols-4"}`}
|
2024-04-19 06:34:16 +03:00
|
|
|
>
|
2024-04-04 23:55:04 +03:00
|
|
|
{statsHistory.length != 0 ? (
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="rounded-lg bg-background_alt p-2.5 md:rounded-2xl">
|
2024-04-04 19:24:23 +03:00
|
|
|
<div className="mb-5">Detector Inference Speed</div>
|
|
|
|
|
{detInferenceTimeSeries.map((series) => (
|
|
|
|
|
<ThresholdBarGraph
|
|
|
|
|
key={series.name}
|
|
|
|
|
graphId={`${series.name}-inference`}
|
|
|
|
|
name={series.name}
|
|
|
|
|
unit="ms"
|
|
|
|
|
threshold={InferenceThreshold}
|
|
|
|
|
updateTimes={updateTimes}
|
|
|
|
|
data={[series]}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
2024-05-14 18:06:44 +03:00
|
|
|
<Skeleton className="aspect-video w-full rounded-lg md:rounded-2xl" />
|
2024-04-04 19:24:23 +03:00
|
|
|
)}
|
2024-04-19 06:34:16 +03:00
|
|
|
{statsHistory.length != 0 ? (
|
|
|
|
|
<>
|
|
|
|
|
{detTempSeries && (
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="rounded-lg bg-background_alt p-2.5 md:rounded-2xl">
|
2024-04-19 06:34:16 +03:00
|
|
|
<div className="mb-5">Detector Temperature</div>
|
|
|
|
|
{detTempSeries.map((series) => (
|
|
|
|
|
<ThresholdBarGraph
|
|
|
|
|
key={series.name}
|
|
|
|
|
graphId={`${series.name}-temp`}
|
|
|
|
|
name={series.name}
|
|
|
|
|
unit="°C"
|
|
|
|
|
threshold={DetectorTempThreshold}
|
|
|
|
|
updateTimes={updateTimes}
|
|
|
|
|
data={[series]}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
2024-05-14 18:06:44 +03:00
|
|
|
<Skeleton className="aspect-video w-full" />
|
2024-04-19 06:34:16 +03:00
|
|
|
)}
|
2024-04-04 19:24:23 +03:00
|
|
|
{statsHistory.length != 0 ? (
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="rounded-lg bg-background_alt p-2.5 md:rounded-2xl">
|
2024-04-04 19:24:23 +03:00
|
|
|
<div className="mb-5">Detector CPU Usage</div>
|
|
|
|
|
{detCpuSeries.map((series) => (
|
|
|
|
|
<ThresholdBarGraph
|
|
|
|
|
key={series.name}
|
|
|
|
|
graphId={`${series.name}-cpu`}
|
|
|
|
|
unit="%"
|
|
|
|
|
name={series.name}
|
|
|
|
|
threshold={DetectorCpuThreshold}
|
|
|
|
|
updateTimes={updateTimes}
|
|
|
|
|
data={[series]}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
2024-05-14 18:06:44 +03:00
|
|
|
<Skeleton className="aspect-video w-full" />
|
2024-04-04 19:24:23 +03:00
|
|
|
)}
|
|
|
|
|
{statsHistory.length != 0 ? (
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="rounded-lg bg-background_alt p-2.5 md:rounded-2xl">
|
2024-04-04 19:24:23 +03:00
|
|
|
<div className="mb-5">Detector Memory Usage</div>
|
|
|
|
|
{detMemSeries.map((series) => (
|
|
|
|
|
<ThresholdBarGraph
|
|
|
|
|
key={series.name}
|
|
|
|
|
graphId={`${series.name}-mem`}
|
|
|
|
|
unit="%"
|
|
|
|
|
name={series.name}
|
|
|
|
|
threshold={DetectorMemThreshold}
|
|
|
|
|
updateTimes={updateTimes}
|
|
|
|
|
data={[series]}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
2024-05-14 18:06:44 +03:00
|
|
|
<Skeleton className="aspect-video w-full" />
|
2024-04-04 19:24:23 +03:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{(statsHistory.length == 0 || statsHistory[0].gpu_usages) && (
|
|
|
|
|
<>
|
|
|
|
|
<div className="mt-4 flex items-center justify-between">
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="text-sm font-medium text-muted-foreground">
|
2024-04-04 19:24:23 +03:00
|
|
|
GPUs
|
|
|
|
|
</div>
|
2024-04-04 23:55:04 +03:00
|
|
|
{canGetGpuInfo && (
|
|
|
|
|
<Button
|
|
|
|
|
className="cursor-pointer"
|
|
|
|
|
size="sm"
|
|
|
|
|
onClick={() => setShowVainfo(true)}
|
|
|
|
|
>
|
|
|
|
|
Hardware Info
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
2024-04-04 19:24:23 +03:00
|
|
|
</div>
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className=" mt-4 grid grid-cols-1 gap-2 sm:grid-cols-2">
|
2024-04-04 19:24:23 +03:00
|
|
|
{statsHistory.length != 0 ? (
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="rounded-lg bg-background_alt p-2.5 md:rounded-2xl">
|
2024-04-04 19:24:23 +03:00
|
|
|
<div className="mb-5">GPU Usage</div>
|
|
|
|
|
{gpuSeries.map((series) => (
|
|
|
|
|
<ThresholdBarGraph
|
|
|
|
|
key={series.name}
|
|
|
|
|
graphId={`${series.name}-gpu`}
|
|
|
|
|
name={series.name}
|
2024-04-14 19:14:10 +03:00
|
|
|
unit="%"
|
2024-04-04 19:24:23 +03:00
|
|
|
threshold={GPUUsageThreshold}
|
|
|
|
|
updateTimes={updateTimes}
|
|
|
|
|
data={[series]}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
2024-05-14 18:06:44 +03:00
|
|
|
<Skeleton className="aspect-video w-full" />
|
2024-04-04 19:24:23 +03:00
|
|
|
)}
|
|
|
|
|
{statsHistory.length != 0 ? (
|
2024-04-10 02:08:11 +03:00
|
|
|
<>
|
|
|
|
|
{gpuMemSeries && (
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="rounded-lg bg-background_alt p-2.5 md:rounded-2xl">
|
2024-04-10 02:08:11 +03:00
|
|
|
<div className="mb-5">GPU Memory</div>
|
|
|
|
|
{gpuMemSeries.map((series) => (
|
|
|
|
|
<ThresholdBarGraph
|
|
|
|
|
key={series.name}
|
|
|
|
|
graphId={`${series.name}-mem`}
|
2024-04-14 19:14:10 +03:00
|
|
|
unit="%"
|
2024-04-10 02:08:11 +03:00
|
|
|
name={series.name}
|
|
|
|
|
threshold={GPUMemThreshold}
|
|
|
|
|
updateTimes={updateTimes}
|
|
|
|
|
data={[series]}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
2024-04-04 19:24:23 +03:00
|
|
|
) : (
|
2024-05-14 18:06:44 +03:00
|
|
|
<Skeleton className="aspect-video w-full" />
|
2024-04-04 19:24:23 +03:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="mt-4 text-sm font-medium text-muted-foreground">
|
2024-04-04 19:24:23 +03:00
|
|
|
Other Processes
|
|
|
|
|
</div>
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="mt-4 grid grid-cols-1 gap-2 sm:grid-cols-2">
|
2024-04-04 19:24:23 +03:00
|
|
|
{statsHistory.length != 0 ? (
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="rounded-lg bg-background_alt p-2.5 md:rounded-2xl">
|
2024-04-04 19:24:23 +03:00
|
|
|
<div className="mb-5">Process CPU Usage</div>
|
|
|
|
|
{otherProcessCpuSeries.map((series) => (
|
|
|
|
|
<ThresholdBarGraph
|
|
|
|
|
key={series.name}
|
|
|
|
|
graphId={`${series.name}-cpu`}
|
|
|
|
|
name={series.name.replaceAll("_", " ")}
|
|
|
|
|
unit="%"
|
|
|
|
|
threshold={DetectorCpuThreshold}
|
|
|
|
|
updateTimes={updateTimes}
|
|
|
|
|
data={[series]}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
2024-05-14 18:06:44 +03:00
|
|
|
<Skeleton className="aspect-tall w-full" />
|
2024-04-04 19:24:23 +03:00
|
|
|
)}
|
|
|
|
|
{statsHistory.length != 0 ? (
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="rounded-lg bg-background_alt p-2.5 md:rounded-2xl">
|
2024-04-04 19:24:23 +03:00
|
|
|
<div className="mb-5">Process Memory Usage</div>
|
|
|
|
|
{otherProcessMemSeries.map((series) => (
|
|
|
|
|
<ThresholdBarGraph
|
|
|
|
|
key={series.name}
|
|
|
|
|
graphId={`${series.name}-mem`}
|
|
|
|
|
unit="%"
|
|
|
|
|
name={series.name.replaceAll("_", " ")}
|
|
|
|
|
threshold={DetectorMemThreshold}
|
|
|
|
|
updateTimes={updateTimes}
|
|
|
|
|
data={[series]}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
2024-05-14 18:06:44 +03:00
|
|
|
<Skeleton className="aspect-tall w-full" />
|
2024-04-04 19:24:23 +03:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|