def print_numa_stats(numafiles):
 for numafilename in numafiles:
  numafile = open(numafilename)
  node_id = int(numafile.name[(numafile.name.find('/node/node') + 10):(-9)])
  ts = int(time.time())
  stats = dict((line.split() for line in numafile.read().splitlines()))
  for (stat, tag) in (('numa_hit', 'hit'), ('numa_miss', 'miss')):
   print ('sys.numa.zoneallocs %d %s node=%d type=%s' % (ts, stats[stat], node_id, tag))
  print ('sys.numa.foreign_allocs %d %s node=%d' % (ts, stats['numa_foreign'], node_id))
  for (stat, tag) in (('local_node', 'local'), ('other_node', 'remote')):
   print ('sys.numa.allocation %d %s node=%d type=%s' % (ts, stats[stat], node_id, tag))
  print ('sys.numa.interleave %d %s node=%d type=hit' % (ts, stats['interleave_hit'], node_id))
  numafile.close()

def print_numa_stats ( numafiles ) : for numafilename in numafiles : numafile = open ( numafilename ) node_id = int ( numafile . name [ ( numafile . name . find ( '/node/node' ) + 10 ) : ( - 9 ) ] ) ts = int ( time . time ( ) ) stats = dict ( ( line . split ( ) for line in numafile . read ( ) . splitlines ( ) ) ) for ( stat , tag ) in ( ( 'numa_hit' , 'hit' ) , ( 'numa_miss' , 'miss' ) ) : print ( 'sys.numa.zoneallocs %d %s node=%d type=%s' % ( ts , stats [ stat ] , node_id , tag ) ) print ( 'sys.numa.foreign_allocs %d %s node=%d' % ( ts , stats [ 'numa_foreign' ] , node_id ) ) for ( stat , tag ) in ( ( 'local_node' , 'local' ) , ( 'other_node' , 'remote' ) ) : print ( 'sys.numa.allocation %d %s node=%d type=%s' % ( ts , stats [ stat ] , node_id , tag ) ) print ( 'sys.numa.interleave %d %s node=%d type=hit' % ( ts , stats [ 'interleave_hit' ] , node_id ) ) numafile . close ( )
from a list of files names .