def read_from_smaps(pid, key):
 smaps = open(('/proc/%s/smaps' % pid))
 smaps_info = smaps.read()
 smaps.close()
 memory_size = 0
 for each_number in re.findall(('%s:\\s+(\\d+)' % key), smaps_info):
  memory_size += int(each_number)
 return memory_size

def read_from_smaps ( pid , key ) : smaps = open ( ( '/proc/%s/smaps' % pid ) ) smaps_info = smaps . read ( ) smaps . close ( ) memory_size = 0 for each_number in re . findall ( ( '%s:\\s+(\\d+)' % key ) , smaps_info ) : memory_size += int ( each_number ) return memory_size
get specific item value from the smaps of a process include all sections .