CPU: {{ row.cpuPercent.toFixed(2) }}%
-
+
{{ $t('monitor.memory') }}: {{ row.memoryPercent.toFixed(2) }}%
+
+
+
+
+
+
+
+
+ {{ loadCPUUnit(row.cpuTotalUsage) }}
+
+
+
+
+ {{ loadCPUUnit(row.systemUsage) }}
+
+
+
+
+
+
+
+
+
+
+ {{ loadMemUnit(row.memoryUsage) }}
+
+
+
+
+ {{ loadMemUnit(row.memoryCache) }}
+
+
+
+
+ {{ loadMemUnit(row.memoryLimit) }}
+
+
+
+
+
@@ -314,7 +374,13 @@ const loadStats = async () => {
for (const item of stats) {
if (container.containerID === item.containerID) {
container.hasLoad = true;
+ container.cpuTotalUsage = item.cpuTotalUsage;
+ container.systemUsage = item.systemUsage;
container.cpuPercent = item.cpuPercent;
+ container.percpuUsage = item.percpuUsage;
+ container.memoryCache = item.memoryCache;
+ container.memoryUsage = item.memoryUsage;
+ container.memoryLimit = item.memoryLimit;
container.memoryPercent = item.memoryPercent;
break;
}
@@ -322,6 +388,38 @@ const loadStats = async () => {
}
};
+const loadCPUUnit = (t: number) => {
+ const num = 1000;
+ if (t < num) return ' ns';
+ if (t < Math.pow(num, 2)) return ' μs';
+ if (t < Math.pow(num, 3)) return ' ms';
+ return ' s';
+};
+function loadCPUValue(t: number) {
+ const num = 1000;
+ if (t < num) return t;
+ if (t < Math.pow(num, 2)) return Number((t / num).toFixed(2));
+ if (t < Math.pow(num, 3)) return Number((t / Math.pow(num, 2)).toFixed(2));
+ return Number((t / Math.pow(num, 3)).toFixed(2));
+}
+const loadMemUnit = (t: number) => {
+ if (t == 0) {
+ return '';
+ }
+ const num = 1024;
+ if (t < num) return ' B';
+ if (t < Math.pow(num, 2)) return ' KiB';
+ if (t < Math.pow(num, 3)) return ' MiB';
+ return ' GiB';
+};
+function loadMemValue(t: number) {
+ const num = 1024;
+ if (t < num) return t;
+ if (t < Math.pow(num, 2)) return Number((t / num).toFixed(2));
+ if (t < Math.pow(num, 3)) return Number((t / Math.pow(num, 2)).toFixed(2));
+ return Number((t / Math.pow(num, 3)).toFixed(2));
+}
+
const dialogOperateRef = ref();
const onEdit = async (container: string) => {
const res = await loadContainerInfo(container);
@@ -549,4 +647,9 @@ onMounted(() => {
.source-font {
font-size: 12px;
}
+.svg-icon {
+ margin-top: -3px;
+ font-size: 6px;
+ cursor: pointer;
+}