tools/linux/procfs.py
def main(argv):
  """The main function for manual testing."""
  _LOGGER.setLevel(logging.WARNING)
  handler = logging.StreamHandler()
  handler.setLevel(logging.WARNING)
  handler.setFormatter(logging.Formatter(
      '%(asctime)s:%(name)s:%(levelname)s:%(message)s'))
  _LOGGER.addHandler(handler)

  pids = []
  for arg in argv[1:]:
    try:
      pid = int(arg)
    except ValueError:
      raise SyntaxError("%s is not an integer." % arg)
    else:
      pids.append(pid)

  procs = {}
  for pid in pids:
    procs[pid] = _ProcessMemory(pid)
    procs[pid].read_all()

    print('=== PID: %d ===' % pid)

    print('   stat: %d' % procs[pid].stat.vsize)
    print('  statm: %d' % (procs[pid].statm.size * 4096))
    print(' status: %d (Peak:%d)' % (procs[pid].status.vm_size * 1024,
                                     procs[pid].status.vm_peak * 1024))
    print('  smaps: %d' % (procs[pid].smaps.size * 1024))
    print('pagemap: %d' % procs[pid].pagemap.vsize)
    print('   stat: %d' % (procs[pid].stat.rss * 4096))
    print('  statm: %d' % (procs[pid].statm.resident * 4096))
    print(' status: %d (Peak:%d)' % (procs[pid].status.vm_rss * 1024,
                                     procs[pid].status.vm_hwm * 1024))
    print('  smaps: %d' % (procs[pid].smaps.rss * 1024))
    print('pagemap: %d' % procs[pid].pagemap.present)

  return 0
The main function for manual testing.
The main function for manual testing.
The main function for manual testing .
def main(argv):
  _LOGGER.setLevel(logging.WARNING)
  handler = logging.StreamHandler()
  handler.setLevel(logging.WARNING)
  handler.setFormatter(logging.Formatter(
      '%(asctime)s:%(name)s:%(levelname)s:%(message)s'))
  _LOGGER.addHandler(handler)
  pids = []
  for arg in argv[1:]:
    try:
      pid = int(arg)
    except ValueError:
      raise SyntaxError("%s is not an integer." % arg)
    else:
      pids.append(pid)
  procs = {}
  for pid in pids:
    procs[pid] = _ProcessMemory(pid)
    procs[pid].read_all()
    print('=== PID: %d ===' % pid)
    print('   stat: %d' % procs[pid].stat.vsize)
    print('  statm: %d' % (procs[pid].statm.size * 4096))
    print(' status: %d (Peak:%d)' % (procs[pid].status.vm_size * 1024,
                                     procs[pid].status.vm_peak * 1024))
    print('  smaps: %d' % (procs[pid].smaps.size * 1024))
    print('pagemap: %d' % procs[pid].pagemap.vsize)
    print('   stat: %d' % (procs[pid].stat.rss * 4096))
    print('  statm: %d' % (procs[pid].statm.resident * 4096))
    print(' status: %d (Peak:%d)' % (procs[pid].status.vm_rss * 1024,
                                     procs[pid].status.vm_hwm * 1024))
    print('  smaps: %d' % (procs[pid].smaps.rss * 1024))
    print('pagemap: %d' % procs[pid].pagemap.present)
  return 0
def main ( argv ) : _LOGGER . setLevel ( logging . WARNING ) handler = logging . StreamHandler ( ) handler . setLevel ( logging . WARNING ) handler . setFormatter ( logging . Formatter ( '%(asctime)s:%(name)s:%(levelname)s:%(message)s' ) ) _LOGGER . addHandler ( handler ) pids = [ ] for arg in argv [ 1 : ] : try : pid = int ( arg ) except ValueError : raise SyntaxError ( "%s is not an integer." % arg ) else : pids . append ( pid ) procs = { } for pid in pids : procs [ pid ] = _ProcessMemory ( pid ) procs [ pid ] . read_all ( ) print ( '=== PID: %d ===' % pid ) print ( '   stat: %d' % procs [ pid ] . stat . vsize ) print ( '  statm: %d' % ( procs [ pid ] . statm . size * 4096 ) ) print ( ' status: %d (Peak:%d)' % ( procs [ pid ] . status . vm_size * 1024 , procs [ pid ] . status . vm_peak * 1024 ) ) print ( '  smaps: %d' % ( procs [ pid ] . smaps . size * 1024 ) ) print ( 'pagemap: %d' % procs [ pid ] . pagemap . vsize ) print ( '   stat: %d' % ( procs [ pid ] . stat . rss * 4096 ) ) print ( '  statm: %d' % ( procs [ pid ] . statm . resident * 4096 ) ) print ( ' status: %d (Peak:%d)' % ( procs [ pid ] . status . vm_rss * 1024 , procs [ pid ] . status . vm_hwm * 1024 ) ) print ( '  smaps: %d' % ( procs [ pid ] . smaps . rss * 1024 ) ) print ( 'pagemap: %d' % procs [ pid ] . pagemap . present ) return 0
The main function for manual testing.
The main function for manual testing .
"""The main function for manual testing."""
argv