mirror of https://gitlab.com/pamhyr/pamhyr2
Debug: Add memory usage to debug timer window.
parent
bdc09addfa
commit
e5dbba362a
|
|
@ -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"))
|
||||
|
|
|
|||
|
|
@ -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" +
|
||||
"<b>" +
|
||||
f"{self._process.memory_info().rss / (1000 * 1000):.3f}" +
|
||||
"</b> 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()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,13 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QTableView" name="tableView"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
|
|
|
|||
Loading…
Reference in New Issue