def read_from_numa_maps(pid, key):
 numa_maps = open(('/proc/%s/numa_maps' % pid))
 numa_map_info = numa_maps.read()
 numa_maps.close()
 numa_maps_dict = {}
 numa_pattern = ('(^[\\dabcdfe]+)\\s+.*%s[=:](\\d+)' % key)
 for (address, number) in re.findall(numa_pattern, numa_map_info, re.M):
  numa_maps_dict[address] = number
 return numa_maps_dict

def read_from_numa_maps ( pid , key ) : numa_maps = open ( ( '/proc/%s/numa_maps' % pid ) ) numa_map_info = numa_maps . read ( ) numa_maps . close ( ) numa_maps_dict = { } numa_pattern = ( '(^[\\dabcdfe]+)\\s+.*%s[=:](\\d+)' % key ) for ( address , number ) in re . findall ( numa_pattern , numa_map_info , re . M ) : numa_maps_dict [ address ] = number return numa_maps_dict
get the process numa related info from numa_maps .