fix: use cumulative CPU average for ffmpeg monitoring
Delta sampling over 2s returns 0-1 integer ticks for low-CPU processes (ffmpeg copy mode ~0.3% CPU), always rounding to 0.0%. Switch to cumulative average (total_cpu_ticks / clk_tck / elapsed) — same method ps uses — which gives stable, accurate readings. Also show 2 decimal places so values like 0.34% are visible.
This commit is contained in:
@@ -237,7 +237,7 @@ export default function Dashboard() {
|
||||
<StatCard
|
||||
icon={<Cpu size={20} className={totalCpu > 80 ? 'text-red-400' : totalCpu > 40 ? 'text-yellow-400' : 'text-cyan-400'} />}
|
||||
label="ffmpeg CPU total"
|
||||
value={`${totalCpu.toFixed(1)}%`}
|
||||
value={`${totalCpu.toFixed(2)}%`}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -330,7 +330,7 @@ export default function Dashboard() {
|
||||
s.ffmpeg_cpu_pct > 40 ? 'text-yellow-400' :
|
||||
'text-gray-400'
|
||||
}`}>
|
||||
{s.ffmpeg_cpu_pct.toFixed(1)}%
|
||||
{s.ffmpeg_cpu_pct.toFixed(2)}%
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user