diff --git a/web/src/pages/System.tsx b/web/src/pages/System.tsx
index cdbb99cb0..e2bd57020 100644
--- a/web/src/pages/System.tsx
+++ b/web/src/pages/System.tsx
@@ -11,7 +11,7 @@ function System() {
});
// stats data pieces
- const inferenceTimeSeries = useMemo(() => {
+ const detInferenceTimeSeries = useMemo(() => {
if (!statsHistory) {
return [];
}
@@ -33,7 +33,7 @@ function System() {
});
return Object.values(series);
}, [statsHistory]);
- const cpuMemSeries = useMemo(() => {
+ const detCpuSeries = useMemo(() => {
if (!statsHistory) {
return [];
}
@@ -45,22 +45,40 @@ function System() {
statsHistory.forEach((stats) => {
const statTime = new Date(stats.service.last_updated * 1000);
- Object.entries(stats.detectors).forEach(([key, detectorStats]) => {
- const cpuKey = `${key}-cpu`;
- const memKey = `${key}-mem`;
-
- if (!(cpuKey in series)) {
- series[cpuKey] = { name: `${key} Cpu`, data: [] };
+ Object.entries(stats.detectors).forEach(([key, detStats]) => {
+ if (!(key in series)) {
+ series[key] = { name: key, data: [] };
}
- if (!(memKey in series)) {
- series[memKey] = { name: `${key} Memory`, data: [] };
+ series[key].data.push({
+ x: statTime,
+ 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: any; y: any }[] };
+ } = {};
+
+ statsHistory.forEach((stats) => {
+ const statTime = new Date(stats.service.last_updated * 1000);
+
+ Object.entries(stats.detectors).forEach(([key, detStats]) => {
+ if (!(key in series)) {
+ series[key] = { name: key, data: [] };
}
- const detUsages = stats.cpu_usages[detectorStats.pid.toString()];
-
- series[cpuKey].data.push({ x: statTime, y: detUsages.cpu });
- series[memKey].data.push({ x: statTime, y: detUsages.mem });
+ series[key].data.push({
+ x: statTime,
+ y: stats.cpu_usages[detStats.pid.toString()].mem,
+ });
});
});
return Object.values(series);
@@ -169,24 +187,30 @@ function System() {