mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-27 12:39:01 +08:00
feat: 增加 Intel Arc 显卡 适配 (#6435)
This commit is contained in:
parent
ef0bb12fbd
commit
7cdcf9b757
@ -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"`
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ export namespace Dashboard {
|
||||
diskData: Array<DiskInfo>;
|
||||
|
||||
gpuData: Array<GPUInfo>;
|
||||
xpuData: Array<XPUInfo>;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -364,6 +364,7 @@ const currentInfo = ref<Dashboard.CurrentInfo>({
|
||||
|
||||
diskData: [],
|
||||
gpuData: [],
|
||||
xpuData: [],
|
||||
|
||||
netBytesSent: 0,
|
||||
netBytesRecv: 0,
|
||||
|
@ -222,6 +222,51 @@
|
||||
<span class="input-help" v-else>{{ item.productName }}</span>
|
||||
</el-col>
|
||||
</template>
|
||||
<template v-for="(item, index) of currentInfo.xpuData" :key="index">
|
||||
<el-col
|
||||
:xs="12"
|
||||
:sm="12"
|
||||
:md="6"
|
||||
:lg="6"
|
||||
:xl="6"
|
||||
align="center"
|
||||
v-if="showMore || index < 4 - currentInfo.diskData.length"
|
||||
>
|
||||
<el-popover placement="bottom" :width="250" trigger="hover" v-if="chartsOption[`gpu${index}`]">
|
||||
<el-row :gutter="5">
|
||||
<el-tag style="font-weight: 500">{{ $t('home.baseInfo') }}:</el-tag>
|
||||
</el-row>
|
||||
<el-row :gutter="5">
|
||||
<el-tag class="tagClass">{{ $t('monitor.gpuUtil') }}: {{ item.memoryUtil }}</el-tag>
|
||||
</el-row>
|
||||
<el-row :gutter="5">
|
||||
<el-tag class="tagClass">{{ $t('monitor.temperature') }}: {{ item.temperature }}</el-tag>
|
||||
</el-row>
|
||||
<el-row :gutter="5">
|
||||
<el-tag class="tagClass">{{ $t('monitor.powerUsage') }}: {{ item.power }}</el-tag>
|
||||
</el-row>
|
||||
<el-row :gutter="5">
|
||||
<el-tag class="tagClass">
|
||||
{{ $t('monitor.memoryUsage') }}: {{ item.memoryUsed }}/{{ item.memory }}
|
||||
</el-tag>
|
||||
</el-row>
|
||||
<template #reference>
|
||||
<v-charts
|
||||
@click="goGPU()"
|
||||
height="160px"
|
||||
:id="`gpu${index}`"
|
||||
type="pie"
|
||||
:option="chartsOption[`gpu${index}`]"
|
||||
v-if="chartsOption[`gpu${index}`]"
|
||||
/>
|
||||
</template>
|
||||
</el-popover>
|
||||
<el-tooltip :content="item.deviceName" v-if="item.deviceName.length > 25">
|
||||
<span class="input-help">{{ item.deviceName.substring(0, 22) }}...</span>
|
||||
</el-tooltip>
|
||||
<span class="input-help" v-else>{{ item.deviceName }}</span>
|
||||
</el-col>
|
||||
</template>
|
||||
<el-col :xs="12" :sm="12" :md="6" :lg="6" :xl="6" align="center">
|
||||
<el-button v-if="!showMore" link type="primary" @click="showMore = true" class="buttonClass">
|
||||
{{ $t('tabs.more') }}
|
||||
@ -268,6 +313,9 @@ const baseInfo = ref<Dashboard.BaseInfo>({
|
||||
cpuLogicalCores: 0,
|
||||
cpuModelName: '',
|
||||
currentInfo: null,
|
||||
|
||||
ipv4Addr: '',
|
||||
systemProxy: '',
|
||||
});
|
||||
const currentInfo = ref<Dashboard.CurrentInfo>({
|
||||
uptime: 0,
|
||||
@ -301,6 +349,7 @@ const currentInfo = ref<Dashboard.CurrentInfo>({
|
||||
|
||||
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('%', ''))),
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user