contrib/memory.py
changeset 52656 3e84e001b6c1
parent 48875 6000f5b25c9b
equal deleted inserted replaced
52655:5027ae0d89b3 52656:3e84e001b6c1
    13 
    13 
    14 
    14 
    15 def memusage(ui):
    15 def memusage(ui):
    16     """Report memory usage of the current process."""
    16     """Report memory usage of the current process."""
    17     result = {'peak': 0, 'rss': 0}
    17     result = {'peak': 0, 'rss': 0}
    18     with open('/proc/self/status', 'r') as status:
    18     with open('/proc/self/status') as status:
    19         # This will only work on systems with a /proc file system
    19         # This will only work on systems with a /proc file system
    20         # (like Linux).
    20         # (like Linux).
    21         for line in status:
    21         for line in status:
    22             parts = line.split()
    22             parts = line.split()
    23             key = parts[0][2:-1].lower()
    23             key = parts[0][2:-1].lower()