mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
c60d8df5e4
Archive obtained from https://psutil.googlecode.com/files/psutil-1.0.1.tar.gz and extracted over existing source code without modifications.
36 lines
1014 B
Python
Executable File
36 lines
1014 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
"""
|
|
A clone of 'pmap' utility on Linux, 'vmmap' on OSX and 'procstat -v' on BSD.
|
|
Report memory map of a process.
|
|
"""
|
|
|
|
import sys
|
|
|
|
import psutil
|
|
from psutil._compat import print_
|
|
|
|
def main():
|
|
if len(sys.argv) != 2:
|
|
sys.exit('usage: pmap pid')
|
|
p = psutil.Process(int(sys.argv[1]))
|
|
print_("pid=%s, name=%s" % (p.pid, p.name))
|
|
templ = "%-16s %10s %-7s %s"
|
|
print_(templ % ("Address", "RSS", "Mode", "Mapping"))
|
|
total_rss = 0
|
|
for m in p.get_memory_maps(grouped=False):
|
|
total_rss += m.rss
|
|
print_(templ % (m.addr.split('-')[0].zfill(16),
|
|
str(m.rss / 1024) + 'K' ,
|
|
m.perms,
|
|
m.path))
|
|
print_("-" * 33)
|
|
print_(templ % ("Total", str(total_rss / 1024) + 'K', '', ''))
|
|
|
|
if __name__ == '__main__':
|
|
main()
|