summaryrefslogtreecommitdiff
path: root/scripts/procinfo.py
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-02-09 13:21:16 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2016-02-09 13:21:16 +0100
commitf0211e90a9c52e61fca2a197a894642f2dff74e7 (patch)
tree0ed9cb0cdbb98986d7629928291f58af7f1ff0b7 /scripts/procinfo.py
parent5018d79a8980b7767370333108b4e98fb4ca44df (diff)
downloadpsutil-f0211e90a9c52e61fca2a197a894642f2dff74e7.tar.gz
fix #762: add sripts/procsmem.py script.
Diffstat (limited to 'scripts/procinfo.py')
-rwxr-xr-xscripts/procinfo.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/scripts/procinfo.py b/scripts/procinfo.py
index bbb0b8e4..9990086f 100755
--- a/scripts/procinfo.py
+++ b/scripts/procinfo.py
@@ -58,9 +58,7 @@ def print_(a, b):
fmt = '\x1b[1;32m%-17s\x1b[0m %s' % (a, b)
else:
fmt = '%-15s %s' % (a, b)
- # python 2/3 compatibility layer
- sys.stdout.write(fmt + '\n')
- sys.stdout.flush()
+ print(fmt)
def run(pid):
@@ -125,12 +123,12 @@ def run(pid):
for child in children:
print_('', 'pid=%s name=%s' % (child.pid, child.name()))
- if pinfo['open_files'] != ACCESS_DENIED:
+ if pinfo['open_files'] != ACCESS_DENIED and pinfo['open_files']:
print_('open files', '')
for file in pinfo['open_files']:
print_('', 'fd=%s %s ' % (file.fd, file.path))
- if pinfo['threads']:
+ if pinfo['threads'] and len(pinfo['threads']) > 1:
print_('running threads', '')
for thread in pinfo['threads']:
print_('', 'id=%s, user-time=%s, sys-time=%s' % (