From 7cdcf9b757d398ca6b058211a1bc213c30628b04 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:55:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20Intel=20Arc=20?= =?UTF-8?q?=E6=98=BE=E5=8D=A1=20=E9=80=82=E9=85=8D=20(#6435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/dashboard.go | 11 +++++ backend/app/service/dashboard.go | 17 +++++++ backend/utils/xpack/xpack.go | 4 ++ frontend/src/api/interface/dashboard.ts | 11 +++++ frontend/src/views/home/index.vue | 1 + frontend/src/views/home/status/index.vue | 56 ++++++++++++++++++++++++ 6 files changed, 100 insertions(+) diff --git a/backend/app/dto/dashboard.go b/backend/app/dto/dashboard.go index 3275ac421..0acb38661 100644 --- a/backend/app/dto/dashboard.go +++ b/backend/app/dto/dashboard.go @@ -73,6 +73,7 @@ type DashboardCurrent struct { NetBytesRecv uint64 `json:"netBytesRecv"` GPUData []GPUInfo `json:"gpuData"` + XPUData []XPUInfo `json:"xpuData"` ShotTime time.Time `json:"shotTime"` } @@ -106,3 +107,13 @@ type GPUInfo struct { MemTotal string `json:"memTotal"` FanSpeed string `json:"fanSpeed"` } + +type XPUInfo struct { + DeviceID int `json:"deviceID"` + DeviceName string `json:"deviceName"` + Memory string `json:"memory"` + Temperature string `json:"temperature"` + MemoryUsed string `json:"memoryUsed"` + Power string `json:"power"` + MemoryUtil string `json:"memoryUtil"` +} diff --git a/backend/app/service/dashboard.go b/backend/app/service/dashboard.go index b83efb984..b40da97b5 100644 --- a/backend/app/service/dashboard.go +++ b/backend/app/service/dashboard.go @@ -178,6 +178,7 @@ func (u *DashboardService) LoadCurrentInfo(ioOption string, netOption string) *d currentInfo.DiskData = loadDiskInfo() currentInfo.GPUData = loadGPUInfo() + currentInfo.XPUData = loadXpuInfo() if ioOption == "all" { diskInfo, _ := disk.IOCounters() @@ -346,3 +347,19 @@ func loadGPUInfo() []dto.GPUInfo { } return data } + +func loadXpuInfo() []dto.XPUInfo { + list := xpack.LoadXpuInfo() + if len(list) == 0 { + return nil + } + var data []dto.XPUInfo + for _, gpu := range list { + var dataItem dto.XPUInfo + if err := copier.Copy(&dataItem, &gpu); err != nil { + continue + } + data = append(data, dataItem) + } + return data +} diff --git a/backend/utils/xpack/xpack.go b/backend/utils/xpack/xpack.go index 14cf0b913..b8161d86a 100644 --- a/backend/utils/xpack/xpack.go +++ b/backend/utils/xpack/xpack.go @@ -32,6 +32,10 @@ func LoadGpuInfo() []interface{} { return nil } +func LoadXpuInfo() []interface{} { + return nil +} + func StartClam(startClam model.Clam, isUpdate bool) (int, error) { return 0, buserr.New(constant.ErrXpackNotFound) } diff --git a/frontend/src/api/interface/dashboard.ts b/frontend/src/api/interface/dashboard.ts index e5728289b..b6f0a668e 100644 --- a/frontend/src/api/interface/dashboard.ts +++ b/frontend/src/api/interface/dashboard.ts @@ -64,6 +64,7 @@ export namespace Dashboard { diskData: Array; gpuData: Array; + xpuData: Array; netBytesSent: number; netBytesRecv: number; @@ -94,4 +95,14 @@ export namespace Dashboard { memoryUsage: string; fanSpeed: string; } + + export interface XPUInfo { + deviceID: number; + deviceName: string; + memory: string; + temperature: string; + memoryUsed: string; + power: string; + memoryUtil: string; + } } diff --git a/frontend/src/views/home/index.vue b/frontend/src/views/home/index.vue index 93c715b9b..0810dbe1c 100644 --- a/frontend/src/views/home/index.vue +++ b/frontend/src/views/home/index.vue @@ -364,6 +364,7 @@ const currentInfo = ref({ diskData: [], gpuData: [], + xpuData: [], netBytesSent: 0, netBytesRecv: 0, diff --git a/frontend/src/views/home/status/index.vue b/frontend/src/views/home/status/index.vue index bb131191b..b9eb23b27 100644 --- a/frontend/src/views/home/status/index.vue +++ b/frontend/src/views/home/status/index.vue @@ -222,6 +222,51 @@ {{ item.productName }} + {{ $t('tabs.more') }} @@ -268,6 +313,9 @@ const baseInfo = ref({ cpuLogicalCores: 0, cpuModelName: '', currentInfo: null, + + ipv4Addr: '', + systemProxy: '', }); const currentInfo = ref({ uptime: 0, @@ -301,6 +349,7 @@ const currentInfo = ref({ diskData: [], gpuData: [], + xpuData: [], netBytesSent: 0, netBytesRecv: 0, @@ -346,6 +395,13 @@ const acceptParams = (current: Dashboard.CurrentInfo, base: Dashboard.BaseInfo, if (currentInfo.value.diskData.length + currentInfo.value.gpuData.length > 5) { showMore.value = isInit ? false : showMore.value || false; } + currentInfo.value.xpuData = currentInfo.value.xpuData || []; + for (let i = 0; i < currentInfo.value.xpuData.length; i++) { + chartsOption.value['gpu' + i] = { + title: 'GPU-' + currentInfo.value.xpuData[i].deviceID, + data: formatNumber(Number(currentInfo.value.xpuData[i].memoryUtil.replaceAll('%', ''))), + }; + } }); };