mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Debug: Add memory usage to debug timer window.
This commit is contained in:
1 parent
bdc09addfa
commit
e5dbba362a
3 files changed
+23
-1
No files matched your search
+1
-1
@@ -20,4 +20,4 @@
|
|||||||
"python-pyqtgraph" "python-qscintilla"
|
"python-pyqtgraph" "python-qscintilla"
|
||||||
"python-numpy@1" "python-shapely" "python-pyshp"
|
"python-numpy@1" "python-shapely" "python-pyshp"
|
||||||
"python-matplotlib" "python-colorama"
|
"python-matplotlib" "python-colorama"
|
||||||
"python-rasterio"))
|
"python-rasterio" "python-psutil"))
|
||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import os
|
||||||
|
import psutil
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
@@ -120,7 +122,10 @@ class TimerWindow(PamhyrWindow):
|
|||||||
parent=parent
|
parent=parent
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self._process = psutil.Process(os.getpid())
|
||||||
|
|
||||||
self.setup_table()
|
self.setup_table()
|
||||||
|
self.setup_label()
|
||||||
self.setup_alarm()
|
self.setup_alarm()
|
||||||
self.setup_connections()
|
self.setup_connections()
|
||||||
|
|
||||||
@@ -136,6 +141,15 @@ class TimerWindow(PamhyrWindow):
|
|||||||
data=None,
|
data=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def setup_label(self):
|
||||||
|
label = self.find(QLabel, "label")
|
||||||
|
label.setText(
|
||||||
|
f" Memory usage:\t" +
|
||||||
|
"<b>" +
|
||||||
|
f"{self._process.memory_info().rss / (1000 * 1000):.3f}" +
|
||||||
|
"</b> MB"
|
||||||
|
)
|
||||||
|
|
||||||
def setup_alarm(self):
|
def setup_alarm(self):
|
||||||
self._alarm = QTimer()
|
self._alarm = QTimer()
|
||||||
self._alarm.start(2000)
|
self._alarm.start(2000)
|
||||||
@@ -148,6 +162,7 @@ class TimerWindow(PamhyrWindow):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self._table.update_lst()
|
self._table.update_lst()
|
||||||
|
self.setup_label()
|
||||||
|
|
||||||
# def reset(self):
|
# def reset(self):
|
||||||
# self._table.reset_timers()
|
# self._table.reset_timers()
|
||||||
|
|||||||
@@ -18,6 +18,13 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTableView" name="tableView"/>
|
<widget class="QTableView" name="tableView"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
|||||||
Reference in new issue
Block a user