Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eaa620b

Browse files
feat: Add real-time process display on the overview page (#10833)
1 parent 18ab07e commit eaa620b

File tree

17 files changed

+393
-228
lines changed

17 files changed

+393
-228
lines changed

‎agent/app/dto/dashboard.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ type DashboardCurrent struct {
116116
GPUData []GPUInfo `json:"gpuData"`
117117
XPUData []XPUInfo `json:"xpuData"`
118118

119+
TopCPUItems []Process `json:"topCPUItems"`
120+
TopMemItems []Process `json:"topMemItems"`
121+
119122
ShotTime time.Time `json:"shotTime"`
120123
}
121124

‎agent/app/service/dashboard.go‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (u *DashboardService) LoadCurrentInfoForNode() *dto.NodeCurrent {
120120
memoryInfo, _ := mem.VirtualMemory()
121121
currentInfo.MemoryTotal = memoryInfo.Total
122122
currentInfo.MemoryAvailable = memoryInfo.Available
123-
currentInfo.MemoryUsed = memoryInfo.Used+memoryInfo.Shared
123+
currentInfo.MemoryUsed = memoryInfo.Used
124124
currentInfo.MemoryUsedPercent = memoryInfo.UsedPercent
125125

126126
swapInfo, _ := mem.SwapMemory()
@@ -194,7 +194,7 @@ func (u *DashboardService) LoadCurrentInfo(ioOption string, netOption string) *d
194194

195195
memoryInfo, _ := mem.VirtualMemory()
196196
currentInfo.MemoryTotal = memoryInfo.Total
197-
currentInfo.MemoryUsed = memoryInfo.Used+memoryInfo.Shared
197+
currentInfo.MemoryUsed = memoryInfo.Used
198198
currentInfo.MemoryFree = memoryInfo.Free
199199
currentInfo.MemoryCache = memoryInfo.Cached + memoryInfo.Buffers
200200
currentInfo.MemoryShard = memoryInfo.Shared
@@ -211,6 +211,9 @@ func (u *DashboardService) LoadCurrentInfo(ioOption string, netOption string) *d
211211
currentInfo.GPUData = loadGPUInfo()
212212
currentInfo.XPUData = loadXpuInfo()
213213

214+
currentInfo.TopCPUItems = loadTopCPU()
215+
currentInfo.TopMemItems = loadTopMem()
216+
214217
if ioOption == "all" {
215218
diskInfo, _ := disk.IOCounters()
216219
for _, state := range diskInfo {

‎agent/app/service/monitor.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func (m *MonitorService) Run() {
183183
if len(totalPercent) == 1 {
184184
itemModel.Cpu = totalPercent[0]
185185
}
186-
topCPU := m.loadTopCPU()
186+
topCPU := loadTopCPU()
187187
if len(topCPU) != 0 {
188188
topItemCPU, err := json.Marshal(topCPU)
189189
if err == nil {
@@ -199,7 +199,7 @@ func (m *MonitorService) Run() {
199199

200200
memoryInfo, _ := mem.VirtualMemory()
201201
itemModel.Memory = memoryInfo.UsedPercent
202-
topMem := m.loadTopMem()
202+
topMem := loadTopMem()
203203
if len(topMem) != 0 {
204204
topMemItem, err := json.Marshal(topMem)
205205
if err == nil {
@@ -350,7 +350,7 @@ func (m *MonitorService) saveNetDataToDB(ctx context.Context, interval float64)
350350
}
351351
}
352352

353-
func (m*MonitorService) loadTopCPU() []dto.Process {
353+
func loadTopCPU() []dto.Process {
354354
processes, err := process.Processes()
355355
if err != nil {
356356
return nil
@@ -400,7 +400,7 @@ func (m *MonitorService) loadTopCPU() []dto.Process {
400400
return top5
401401
}
402402

403-
func (m*MonitorService) loadTopMem() []dto.Process {
403+
func loadTopMem() []dto.Process {
404404
processes, err := process.Processes()
405405
if err != nil {
406406
return nil

‎frontend/src/api/interface/dashboard.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,22 @@ export namespace Dashboard {
103103
gpuData: Array<GPUInfo>;
104104
xpuData: Array<XPUInfo>;
105105

106+
topCPUItems: Array<Process>;
107+
topMemItems: Array<Process>;
108+
106109
netBytesSent: number;
107110
netBytesRecv: number;
108111

109112
shotTime: Date;
110113
}
114+
export interface Process {
115+
name: string;
116+
pid: number;
117+
percent: number;
118+
memory: number;
119+
cmd: string;
120+
user: string;
121+
}
111122
export interface DiskInfo {
112123
path: string;
113124
type: string;

‎frontend/src/lang/modules/en.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ const message = {
426426
ioDelay: 'I/O latency',
427427
uptime: 'Uptime',
428428
runningTime: 'Up since',
429-
mem: 'System',
429+
mem: 'System Memory',
430430
swapMem: 'Swap Partition',
431431

432432
runSmoothly: 'Low load',
@@ -436,6 +436,9 @@ const message = {
436436

437437
core: 'Physical core',
438438
logicCore: 'Logical core',
439+
corePercent: 'Core Usage',
440+
cpuTop: 'Top 5 Processes by CPU Usage',
441+
memTop: 'Top 5 Processes by Memory Usage',
439442
loadAverage: 'Load average in the last 1 minute | Load average in the last {n} minutes',
440443
load: 'Load',
441444
mount: 'Mount point',
@@ -3009,6 +3012,9 @@ const message = {
30093012
stopProcess: 'End',
30103013
viewDetails: 'View details',
30113014
stopProcessWarn: 'Are you sure you want to end this process (PID:{0})?',
3015+
kill: 'Kill Process',
3016+
killNow: 'Kill Now',
3017+
killHelper: 'Killing process {0} may cause some programs to malfunction. Continue?',
30123018
processName: 'Process name',
30133019
},
30143020
tool: {

‎frontend/src/lang/modules/es-es.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,14 +434,17 @@ const message = {
434434
ioDelay: 'Latencia de E/S',
435435
uptime: 'Tiempo en funcionamiento',
436436
runningTime: 'Desde',
437-
mem: 'Sistema',
437+
mem: 'Memoria del Sistema',
438438
swapMem: 'Partición swap',
439439
runSmoothly: 'Carga baja',
440440
runNormal: 'Carga moderada',
441441
runSlowly: 'Carga alta',
442442
runJam: 'Carga pesada',
443443
core: 'Núcleo físico',
444444
logicCore: 'Núcleo lógico',
445+
corePercent: 'Uso del Núcleo',
446+
cpuTop: 'Top 5 de Procesos por Uso de CPU',
447+
memTop: 'Top 5 de Procesos por Uso de Memoria',
445448
loadAverage: 'Promedio de carga en el último minuto | Promedio de carga en los últimos {n} minutos',
446449
load: 'Carga',
447450
mount: 'Punto de montaje',
@@ -2982,6 +2985,9 @@ const message = {
29822985
stopProcess: 'Finalizar',
29832986
viewDetails: 'Ver detalles',
29842987
stopProcessWarn: '¿Seguro que deseas finalizar este proceso (PID:{0})?',
2988+
kill: 'Terminar Proceso',
2989+
killNow: 'Terminar Ahora',
2990+
killHelper: 'Terminar el proceso {0} puede hacer que algunos programas funcionen incorrectamente. ¿Continuar?',
29852991
processName: 'Nombre del proceso',
29862992
},
29872993
tool: {

‎frontend/src/lang/modules/ja.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ const message = {
415415
ioDelay: 'I/Oレイテンシ',
416416
uptime: 'それ以来',
417417
runningTime: '稼働時間',
418-
mem: 'システム',
418+
mem: 'システムメモリ',
419419
swapMem: 'パーティションを交換します',
420420

421421
runSmoothly: '低負荷',
@@ -425,6 +425,9 @@ const message = {
425425

426426
core: '物理コア',
427427
logicCore: '論理コア',
428+
corePercent: 'コア使用率',
429+
cpuTop: 'CPU使用率トップ5のプロセス情報',
430+
memTop: 'メモリ使用率トップ5のプロセス情報',
428431
loadAverage: '最後の1分で平均を積み込みます|最後の{n}分で平均を読み込みます',
429432
load: '負荷',
430433
mount: 'マウントポイント',
@@ -2907,6 +2910,9 @@ const message = {
29072910
stopProcess: '終わり',
29082911
viewDetails: '詳細',
29092912
stopProcessWarn: 'このプロセスを終了したいですか(PID:{0})?',
2913+
kill: 'プロセス終了',
2914+
killNow: '今すぐ終了',
2915+
killHelper: 'プロセス {0} を終了すると一部のプログラムが正常に動作しなくなる可能性があります。続行しますか?',
29102916
processName: 'プロセス名',
29112917
},
29122918
tool: {

‎frontend/src/lang/modules/ko.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ const message = {
418418
ioDelay: 'I/O 지연 시간',
419419
uptime: '작동 시간',
420420
runningTime: '가동 시간',
421-
mem: '시스템',
421+
mem: '시스템 메모리',
422422
swapMem: '스왑 파티션',
423423

424424
runSmoothly: '낮은 부하',
@@ -428,6 +428,9 @@ const message = {
428428

429429
core: '물리적 코어',
430430
logicCore: '논리 코어',
431+
corePercent: '코어 사용률',
432+
cpuTop: 'CPU 사용률 상위 5개 프로세스 정보',
433+
memTop: '메모리 사용률 상위 5개 프로세스 정보',
431434
loadAverage: '지난 1분의 평균 부하 | 지난 {n} 분의 평균 부하',
432435
load: '부하',
433436
mount: '마운트 지점',
@@ -2856,6 +2859,10 @@ const message = {
28562859
stopProcess: '종료',
28572860
viewDetails: '세부 사항',
28582861
stopProcessWarn: '이 프로세스(PID:{0})를 종료하시겠습니까?',
2862+
kill: '프로세스 종료',
2863+
killNow: '즉시 종료',
2864+
killHelper:
2865+
'프로세스 {0}을(를) 종료하면 일부 프로그램이 정상적으로 작동하지 않을 수 있습니다. 계속하시겠습니까?',
28592866
processName: '프로세스 이름',
28602867
},
28612868
tool: {

‎frontend/src/lang/modules/ms.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ const message = {
424424
ioDelay: 'I/O latency',
425425
uptime: 'Up since',
426426
runningTime: 'Uptime',
427-
mem: 'System',
427+
mem: 'Memori Sistem',
428428
swapMem: 'Swap partition',
429429

430430
runSmoothly: 'Beban rendah',
@@ -433,6 +433,9 @@ const message = {
433433
runJam: 'Beban berat',
434434

435435
core: 'Teras Fizikal',
436+
corePercent: 'Penggunaan Teras',
437+
cpuTop: 'Maklumat Proses 5 Teratas Mengikut Penggunaan CPU',
438+
memTop: 'Maklumat Proses 5 Teratas Mengikut Penggunaan Memori',
436439
logicCore: 'Teras Logik',
437440
loadAverage: 'Purata beban dalam 1 minit terakhir | Purata beban dalam {n} minit terakhir',
438441
load: 'Beban',
@@ -2973,6 +2976,10 @@ const message = {
29732976
stopProcess: 'End',
29742977
viewDetails: 'Details',
29752978
stopProcessWarn: 'Are you sure you want to end this process (PID:{0})?',
2979+
kill: 'Hentikan Proses',
2980+
killNow: 'Hentikan Sekarang',
2981+
killHelper:
2982+
'Menghentikan proses {0} mungkin menyebabkan beberapa program tidak berfungsi dengan normal. Teruskan?',
29762983
processName: 'Process name',
29772984
},
29782985
tool: {

‎frontend/src/lang/modules/pt-br.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ const message = {
422422
ioDelay: 'Latência de I/O',
423423
uptime: 'Tempo de atividade',
424424
runningTime: 'Tempo de execução',
425-
mem: 'Memória',
425+
mem: 'Memória do Sistema',
426426
swapMem: 'Partição Swap',
427427

428428
runSmoothly: 'Baixo carregamento',
@@ -432,6 +432,9 @@ const message = {
432432

433433
core: 'Núcleo físico',
434434
logicCore: 'Núcleo lógico',
435+
corePercent: 'Uso do Núcleo',
436+
cpuTop: 'Top 5 Processos por Uso de CPU',
437+
memTop: 'Top 5 Processos por Uso de Memória',
435438
loadAverage: 'Média de carga nos últimos 1 minuto | Média de carga nos últimos {n} minutos',
436439
load: 'Carga',
437440
mount: 'Ponto de montagem',
@@ -2978,6 +2981,9 @@ const message = {
29782981
stopProcess: 'Encerrar',
29792982
viewDetails: 'Detalhes',
29802983
stopProcessWarn: 'Tem certeza de que deseja encerrar este processo (PID:{0})?',
2984+
kill: 'Encerrar Processo',
2985+
killNow: 'Encerrar Agora',
2986+
killHelper: 'Encerrar o processo {0} pode fazer com que alguns programas funcionem incorretamente. Continuar?',
29812987
processName: 'Nome do Processo',
29822988
},
29832989
tool: {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /