aboutsummaryrefslogtreecommitdiffstats
path: root/examples/charts/memoryusage/memoryusage.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/charts/memoryusage/memoryusage.py')
-rw-r--r--examples/charts/memoryusage/memoryusage.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/charts/memoryusage/memoryusage.py b/examples/charts/memoryusage/memoryusage.py
index 0a098014c..7ad6e3594 100644
--- a/examples/charts/memoryusage/memoryusage.py
+++ b/examples/charts/memoryusage/memoryusage.py
@@ -55,6 +55,7 @@ def run_process(command, arguments):
std_output = process.readAllStandardOutput().data().decode('utf-8')
return std_output.split('\n')
+
def get_memory_usage():
result = []
if sys.platform == 'win32':
@@ -83,7 +84,7 @@ def get_memory_usage():
command_column = 12
for line in run_process('ps', ps_options):
tokens = line.split(None)
- if len(tokens) > command_column and "PID" not in tokens: # Percentage and command
+ if len(tokens) > command_column and "PID" not in tokens: # Percentage and command
command = tokens[command_column]
if not command.startswith('['):
command = os.path.basename(command)
@@ -94,6 +95,7 @@ def get_memory_usage():
result.sort(key = lambda x: x[1], reverse=True)
return result
+
class MainWindow(QMainWindow):
def __init__(self):
@@ -117,6 +119,7 @@ class MainWindow(QMainWindow):
self._chart_view = QChartView(self.chart)
self.setCentralWidget(self._chart_view)
+
if __name__ == '__main__':
app = QApplication(sys.argv)
main_win = MainWindow()