From e5dbba362af26cabb59a89bfa3ccfe57a3345fbb Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Fri, 21 Aug 2026 16:55:50 +0200 Subject: [PATCH] Debug: Add memory usage to debug timer window. --- manifest.scm | 2 +- src/View/Debug/Window.py | 15 +++++++++++++++ src/View/ui/DebugTimer.ui | 7 +++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/manifest.scm b/manifest.scm index c3cd49e5..91f2527f 100644 --- a/manifest.scm +++ b/manifest.scm @@ -20,4 +20,4 @@ "python-pyqtgraph" "python-qscintilla" "python-numpy@1" "python-shapely" "python-pyshp" "python-matplotlib" "python-colorama" - "python-rasterio")) + "python-rasterio" "python-psutil")) diff --git a/src/View/Debug/Window.py b/src/View/Debug/Window.py index 06931938..54232cad 100644 --- a/src/View/Debug/Window.py +++ b/src/View/Debug/Window.py @@ -16,6 +16,8 @@ # -*- coding: utf-8 -*- +import os +import psutil import logging import traceback @@ -120,7 +122,10 @@ class TimerWindow(PamhyrWindow): parent=parent ) + self._process = psutil.Process(os.getpid()) + self.setup_table() + self.setup_label() self.setup_alarm() self.setup_connections() @@ -136,6 +141,15 @@ class TimerWindow(PamhyrWindow): data=None, ) + def setup_label(self): + label = self.find(QLabel, "label") + label.setText( + f" Memory usage:\t" + + "" + + f"{self._process.memory_info().rss / (1000 * 1000):.3f}" + + " MB" + ) + def setup_alarm(self): self._alarm = QTimer() self._alarm.start(2000) @@ -148,6 +162,7 @@ class TimerWindow(PamhyrWindow): def update(self): self._table.update_lst() + self.setup_label() # def reset(self): # self._table.reset_timers() diff --git a/src/View/ui/DebugTimer.ui b/src/View/ui/DebugTimer.ui index cc8a2132..151fa718 100644 --- a/src/View/ui/DebugTimer.ui +++ b/src/View/ui/DebugTimer.ui @@ -18,6 +18,13 @@ + + + + TextLabel + + +