def get_vmvalue_from_procfs(vmkey='VmSize', pid=None):
 if (pid is None):
  pid = os.getpid()
 try:
  t = open(('/proc/%d/status' % pid))
 except IOError:
  raise RuntimeError('/proc filesystem not supported')
 if (sys.platform == 'sunos5'):
  return _vmvalue_solaris(vmkey, pid)
 else:
  v = t.read()
  t.close()
  i = v.index((vmkey + ':'))
  v = v[i:].split(None, 3)
  if (len(v) < 3):
   return 0
  return (int(v[1]) * _vmvalue_scale[v[2]])

def get_vmvalue_from_procfs ( vmkey = 'VmSize' , pid = None ) : if ( pid is None ) : pid = os . getpid ( ) try : t = open ( ( '/proc/%d/status' % pid ) ) except IOError : raise RuntimeError ( '/proc filesystem not supported' ) if ( sys . platform == 'sunos5' ) : return _vmvalue_solaris ( vmkey , pid ) else : v = t . read ( ) t . close ( ) i = v . index ( ( vmkey + ':' ) ) v = v [ i : ] . split ( None , 3 ) if ( len ( v ) < 3 ) : return 0 return ( int ( v [ 1 ] ) * _vmvalue_scale [ v [ 2 ] ] )
return virtual memory value for the given pid using the /proc filesystem .