aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-06-18 10:21:25 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-06-21 11:49:39 +0000
commit27a3402507364e15c37fcabfa025c2fed36146f0 (patch)
tree468b79b9d7994645c061e200dc35db6f0d6f2ebb /examples
parent493d8e821b2d8f8a9f14f4f5f48671887a9eef84 (diff)
Fix examples/charts/memoryusage
Verified on Windows and Linux. Task-number: PYSIDE-702 Change-Id: I37d5cca1c9351cb599f9d7152a04c13118dab8e2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/charts/memoryusage.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/charts/memoryusage.py b/examples/charts/memoryusage.py
index ac4d3c4e3..b2c8ed153 100644
--- a/examples/charts/memoryusage.py
+++ b/examples/charts/memoryusage.py
@@ -52,10 +52,8 @@ def runProcess(command, arguments):
process = QProcess()
process.start(command, arguments)
process.waitForFinished()
- result = []
- for line in str(process.readAllStandardOutput()).split(os.linesep):
- result.append(line)
- return result
+ std_output = process.readAllStandardOutput().data().decode('utf-8')
+ return std_output.split('\n')
def getMemoryUsage():
result = []
@@ -82,9 +80,9 @@ def getMemoryUsage():
psOptions = ['-e', '-v']
memoryColumn = 11
commandColumn = 12
- for line in runProcess('ps', psOptions)[1:]:
+ for line in runProcess('ps', psOptions):
tokens = line.split(None)
- if len(tokens) > commandColumn: # Percentage and command
+ if len(tokens) > commandColumn and "PID" not in tokens: # Percentage and command
command = tokens[commandColumn]
if not command.startswith('['):
command = os.path.basename(command)