perf(agent): sort top procs by RAM only, skip per-process CPUPercent
CPUPercent() on every process reads /proc/<pid>/stat for all processes, causing ~19% CPU spike on servers with many containers. Sorting by RAM is a single /proc read per process and much cheaper. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
42dc7020fc
commit
ad531c6dfc
@@ -155,24 +155,20 @@
|
||||
<div x-data="{ showProcs: false }">
|
||||
<button @click="showProcs=!showProcs" class="w-full text-left text-[10px] text-slate-400 hover:text-slate-600 flex items-center gap-1">
|
||||
<svg class="w-3 h-3 transition-transform" :class="showProcs ? 'rotate-90' : ''" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/></svg>
|
||||
Top procesos (<span x-text="(m.top_procs||[]).length"></span>)
|
||||
Top procesos por RAM (<span x-text="(m.top_procs||[]).length"></span>)
|
||||
</button>
|
||||
<template x-if="showProcs">
|
||||
<div class="mt-1.5 bg-slate-50 rounded-lg overflow-hidden">
|
||||
<table class="w-full text-[10px]">
|
||||
<thead><tr class="text-slate-400 border-b border-slate-200">
|
||||
<th class="px-2 py-1 text-left">Proceso</th>
|
||||
<th class="px-2 py-1 text-right">CPU%</th>
|
||||
<th class="px-2 py-1 text-right">RAM</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<template x-for="p in (m.top_procs||[]).slice(0,8)" :key="p.pid">
|
||||
<template x-for="p in (m.top_procs||[]).slice(0,10)" :key="p.pid">
|
||||
<tr class="border-b border-slate-100 last:border-0">
|
||||
<td class="px-2 py-1 font-mono truncate max-w-[90px]" x-text="p.nombre"></td>
|
||||
<td class="px-2 py-1 text-right font-bold"
|
||||
:class="p.cpu > 50 ? 'text-red-600' : p.cpu > 20 ? 'text-amber-600' : 'text-slate-600'"
|
||||
x-text="p.cpu + '%'"></td>
|
||||
<td class="px-2 py-1 text-right text-slate-500 font-mono" x-text="fmtMB(p.ram_mb)"></td>
|
||||
<td class="px-2 py-1 font-mono truncate max-w-[120px]" x-text="p.nombre"></td>
|
||||
<td class="px-2 py-1 text-right text-slate-600 font-mono font-bold" x-text="fmtMB(p.ram_mb)"></td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user