From e38bf3a851347d505f598c39d31593a1f0e3ee85 Mon Sep 17 00:00:00 2001 From: Gabriel20xx Date: Mon, 18 Aug 2025 10:02:02 +0200 Subject: [PATCH] Refactor CPU usage reporting to simplify diagnostics and enhance readability --- main.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/main.py b/main.py index cf9ea19..1450b14 100644 --- a/main.py +++ b/main.py @@ -2072,20 +2072,12 @@ class MainWindow(QtWidgets.QMainWindow): # Program CPU usage (actual per-process percent, smoothed via history) if memory_info.get('has_psutil', False): - # Ensure history contains the latest sample (already appended earlier) if self._resource_history['cpu_percent']: cur_cpu, max_cpu_p, avg_cpu_p = self._get_resource_stats(self._resource_history['cpu_percent']) else: cur_cpu = memory_info.get('cpu_percent', 0.0) max_cpu_p = avg_cpu_p = cur_cpu - - # Loop timing (optional extra diagnostic) - loop_extra = "" - if hasattr(self, '_loop_times') and self._loop_times: - loop_current = self._loop_times[-1] * 1000 # seconds -> ms - loop_extra = f" | Loop {loop_current:.0f}ms" - - program_cpu_text = f"CPU: {cur_cpu:.1f}%\nAvg: {avg_cpu_p:.1f}% | Max: {max_cpu_p:.1f}%{loop_extra}" + program_cpu_text = f"CPU: {cur_cpu:.1f}%\nAvg: {avg_cpu_p:.1f}% | Max: {max_cpu_p:.1f}%" program_cpu_color = ( colors['error'] if cur_cpu > 80 else colors['warning'] if cur_cpu > 60 else